ªð¦^¦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 : ¡i¥Í©R¦b©I§l¶¡¡j¦òªû»¡¡G¡u¥Í©R¦b©I§l¶¡¡C¡v¤HµLªkºÞ¦í¦Û¤vªº¥Í©R¡A§óµLªk¾×¦í¦º´Á¡AÅý¦Û¤v¥Ã¦í¤H¶¡¡C¬JµM¥Í©R¥h¨Ó³o»òµL±`¡A§Ú­Ì§óÀ³¸Ó¦n¦n¦a·R±¤¥¦¡B§Q¥Î¥¦¡B¥R¹ê¥¦¡AÅý³oµL±`¡BÄ_¶Qªº¥Í©R¡A´²µo¥¦¯uµ½¬üªº¥ú½÷¡A¬M·Ó¥X¥Í©R¯u¥¿ªº»ù­È¡C
ªð¦^¦Cªí ¤W¤@¥DÃD