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

excel vba ¥i§_¥Î insert´¡¤J¸ê®Æ¨ì¤u§@ªí

excel vba ¥i§_¥Î insert´¡¤J¸ê®Æ¨ì¤u§@ªí

§Ú¸ÕµÛ¥H¤U¦Cvba·Q­n·s¼W¤@µ§¸ê®Æ¨ì excel 2007 ¤u§@ªí, ¦ý«o¦b¬õ¦r³B«ü¥O(rs.Open sqlcmd, cn)¥X²{¤U¦C¿ù»~°T®§
°õ¦æ¶¥¬q¿ù»~'-2147467259 *80004005)'
¹B§@¥²¶·¨Ï¥Î§ó·s¬d¸ß



½Ð°Ý¬O§_¦³¨º¸Ì¨S¦³³]©w¨ì¶Ü?  ÁÂÁÂ..
  1. Sub main()


  2.     Dim cn As ADODB.Connection
  3.     Dim rs As ADODB.Recordset
  4.     Dim strSQL As String

  5.     strFile = Excel.ActiveWorkbook.FullName
  6.    
  7.    
  8.     strCon = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & strFile & ";Extended Properties=""Excel 8.0;HDR=Yes;IMEX=1"";"

  9.     Set cn = CreateObject("ADODB.Connection")
  10.     Set rs = CreateObject("ADODB.Recordset")
  11.    
  12.     cn.Open strCon
  13.    
  14.    
  15.     sqlcmd = "insert into [¤u§@ªí1$] VALUES ('0145', '§õ¥|')"

  16.     cn.Execute sqlcmd
  17.    
  18.    
  19.    
  20.    
  21.   cn.Close
  22.   Set rs = Nothing
  23.   
  24.    
  25. '     UserForm1.Show
  26.    
  27. End Sub
½Æ»s¥N½X

insert.zip (22 Bytes) ¦^´_ 1# imingho


ªþ¤W´ú¸ÕÀÉ®×.

TOP

        ÀR«ä¦Û¦b : ªY½à§O¤H´N¬O²øÄY¦Û¤v¡C
ªð¦^¦Cªí ¤W¤@¥DÃD