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

[µo°Ý] ¦p¦óÃö³¬¤£¦sÀÉ©O? Set Conn = CreateObject("adodb.connection")

[µo°Ý] ¦p¦óÃö³¬¤£¦sÀÉ©O? Set Conn = CreateObject("adodb.connection")

Conn.Close ½Ð°Ý³o±ø¥N½X¸Ó¦p¦ó³]©w¤~¥i¥HŪ¨ú°ß¿WÀɮפ§«á¥i¥H¤£Ãö³¬¦sÀÉ©O?
©³¤U¨â±ø³£¤£¯à¨Ï¥Î
Conn.Close  False
savechanges:=False


  1. Set Conn = CreateObject("adodb.connection")

  2. ¼Æ¾Ú = "'" & Sheets("ÀɦW").Range("J2") & "'" 'WHERE ±ø¥ó
  3. ¸ô®| = "" & Sheets("ÀɦW").Range("D1") & "" '¸ê®Æ§¨¸ô®|

  4. For x = 2 To Sheets("ÀɦW").[A65536].End(xlUp).Row
  5. Shname = Sheets("ÀɦW").Range("B" & x) 'ÀɦW


  6. 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



  7. 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´Á =" & ¼Æ¾Ú

  8.     ThisWorkbook.Sheets("¤u§@ªí1").[A65536].End(xlUp).Offset(1, 0).CopyFromRecordset Conn.Execute(Sql)
  9.    

  10.     Conn.Close
  11. Next x

  12. Set Conn = Nothing
½Æ»s¥N½X

        ÀR«ä¦Û¦b : ¡i®É¶¡¦¨´N¤@¤Á¡j®É¶¡¥i¥H³y´N¤H®æ¡A¥i¥H¦¨´N¨Æ·~¡A¤]¥i¥HÀx¿n¥\¼w¡C
ªð¦^¦Cªí ¤W¤@¥DÃD