- ©«¤l
- 2035
- ¥DÃD
- 24
- ºëµØ
- 0
- ¿n¤À
- 2031
- ÂI¦W
- 0
- §@·~¨t²Î
- Win7
- ³nÅ骩¥»
- Office2010
- ¾\ŪÅv
- 100
- ©Ê§O
- ¨k
- µù¥U®É¶¡
- 2012-3-22
- ³Ì«áµn¿ý
- 2024-2-1
|
¦^´_ 11# GBKEE
¶¶±a½Ð±Ð±z¡G
¥H¤U´ú¸Õ©ó2003 Excel¤¤¡A ©ó Set cnn «áµo²{ cnn Ȭ° ""¡A
©Ò¥H¦b .Open ®É«K¥X¿ù¤F¡C¦b¤u¨ã->³]©w¤Þ¥Î¶µ¥Ø¤¤nª`·N¨º¨Ç¶µ¦¸¡H
¦ý¬O¦¹»yªk¦b 2010 Àô¹Ò¤U°õ¦æ³£ OK¡A¥¿½TÀ³¦p¦ó³B¸Ì¡H
P.S. ³o¬O§Ú¦b Excel¤u§@ªí³æ»PAccess¸ê®Æ®wªºVBA¤¬°Ê°ÝÃD ¤¤ªº´£°Ý¡A
¦¹³¡¤À¬O¬°¤Fn¦P®É¥H ADODB »yªk¨Ó³B²z¤u§@ªí³æ¤º¤§¸ê®Æ¿ý¦Ó³]©wªº¡C- Sub Test()
- Dim cnn As Object ' New ADODB.Connection
- Dim cmd As Object ' New ADODB.Command
- Dim rs As Object ' New ADODB.Recordset
- Set cnn = CreateObject("ADODB.Connection")
- Set rs = CreateObject("ADODB.Recordset")
- Set cmd = CreateObject("ADODB.Command")
- With cnn
- If .State = 1 Then .Close ' adStateOpen
-
- .ConnectionString = "Driver={Microsoft Excel Driver (*.xls, *.xlsx, *.xlsm, *.xlsb)};DBQ=" & _
- ActiveWorkbook.Path & Application.PathSeparator & ActiveWorkbook.Name
- .Open
- End With
- End Sub
½Æ»s¥N½X |
|