Conn.Close ½Ð°Ý³o±ø¥N½X¸Ó¦p¦ó³]©w¤~¥i¥HŪ¨ú°ß¿WÀɮפ§«á¥i¥H¤£Ãö³¬¦sÀÉ©O?
©³¤U¨â±ø³£¤£¯à¨Ï¥Î
Conn.Close False
savechanges:=False
- Set Conn = CreateObject("adodb.connection")
- ¼Æ¾Ú = "'" & Sheets("ÀɦW").Range("J2") & "'" 'WHERE ±ø¥ó
- ¸ô®| = "" & Sheets("ÀɦW").Range("D1") & "" '¸ê®Æ§¨¸ô®|
- For x = 2 To Sheets("ÀɦW").[A65536].End(xlUp).Row
- Shname = Sheets("ÀɦW").Range("B" & x) 'ÀɦW
-
- Conn.Open "provider=microsoft.ACE.oledb.12.0;Extended Properties='EXCEL 8.0;IMEX=1;HDR=YES;TypeGuessRows=0;ImportMixedTypes=Text';data source=" & ¸ô®| & "\" & Shname 'ThisWorkbook.Path
- Sql = "select ¯S®í_1,¤é´Á_1,½s¸¹_1,À\§O_1,Ãþ§O_1,«~¦W_1,¼Æ¶q_1,³Æµù_1,²§±`_1,¥N¸¹_1,¯S®í_2,¤é´Á_2,½s¸¹_2,À\§O_2,Ãþ§O_2,«~¦W_2,¼Æ¶q_2,³Æµù_2,²§±`_2,¥N¸¹_2,¯S®í_3,¤é´Á_3,½s¸¹_3,À\§O_3,Ãþ§O_3,«~¦W_3,¼Æ¶q_3,³Æµù_3,²§±`_3,¥N¸¹_3 from [¬£³æ$] where ©P´Á =" & ¼Æ¾Ú
- ThisWorkbook.Sheets("¤u§@ªí1").[A65536].End(xlUp).Offset(1, 0).CopyFromRecordset Conn.Execute(Sql)
-
- Conn.Close
- Next x
- Set Conn = Nothing
½Æ»s¥N½X |