ªð¦^¦Cªí ¤W¤@¥DÃD µo©«

[µo°Ý] Excel VBAŪ¨ú¨ä¥LExcelÀɮתº°ÝÃD

[µo°Ý] Excel VBAŪ¨ú¨ä¥LExcelÀɮתº°ÝÃD

¤j®a¦n¡A¤p§Ì¥Ø«e¬Oªì±µÄ²VBAªº¾Ç²ßªÌ¡A

³Ìªñ¬°¤F¤u§@¤Wªº»Ý¨D¡A¼g¤F­ÓŪ¨ú¨ä¥LExcelÀɮתºVBAµ{¦¡

¥D­n¥Øªº¬O­n±q¥Ø«eªº¤u§@ªíŪ¨úBook3.xls¤ºªº¸ê®Æ¨Ã§e²{¡A

µ{¦¡½X¦p¤U¡G

Sub Test()
  1. Sub Test()

  2. Dim cn As ADODB.Connection
  3. Dim rsT As ADODB.Recordset

  4. Set cn = New ADODB.Connection
  5. With cn
  6. .Provider = "Microsoft.Jet.OLEDB.4.0"
  7. .ConnectionString = "Data Source=C:\Users\Eddie\Desktop\Book3.xls;" & _
  8. "Extended Properties=Excel 8.0;"
  9. .Open
  10. End With

  11. Set rsT = cn.OpenSchema(adSchemaTables, Array(Empty, Empty, "book1", Empty))

  12. Range("A1").CopyFromRecordset rsT

  13. rsT.Close
  14. cn.Close

  15. Set rsT = Nothing
  16. Set cn = Nothing

  17. End Sub
½Æ»s¥N½X
¦bµ{¦¡°õ¦æ¤W¨S¦³¥X²{Error, ¦ý¬O°ÝÃD¦b©óµLªk¦b¥Ø«eªº¤u§@ªí¤WÅã¥Ü¡A

½Ð°Ý¦U¦ì«e½ú¬O­þ¸Ì¥X²{°ÝÃD©O?

ÁÂÁÂ

¦^´_ 1# jemery127

½Ð°Ý¦³¤H¹ï³o°ÝÃD¤F¸Ñ¶Ü? ¬O§_¥i¥Hµ¹ÂI«Øij©O? ÁÂÁÂ

TOP

        ÀR«ä¦Û¦b : °µ¦n¨Æ¤£¯à¤Ö§Ú¤@¤H¡A°µÃa¨Æ¤£¯à¦h§Ú¤@¤H¡C
ªð¦^¦Cªí ¤W¤@¥DÃD