View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
nevada nevada is offline
external usenet poster
 
Posts: 1
Default ODBC connection for insert into SQL Server

I'm able to do the following to SELECT from a SQL Server:

--

With ActiveSheet.QueryTables.Add(Connection:= _
"ODBC;DRIVER=SQL Server;SERVER=myServer;UID=;APP=Microsoft Office
XP;WSID=myWorkstation;Trusted_Connection=Yes" _
, Destination:=newsheet.Range("A1"))
.CommandText = Array( _
"SELECT myData FROM myTable")

---snip ---

End With

--

I did this easily enough through Data/Import External Data.

How do I establish the same connection in order to do an INSERT into
the SQL Server? Can I do this through an ODBC connection?

For some reason I'm not able to create an ADODB.Connection object. I
do have Microsoft ADO Ext 2.7 added as a resource. Is there another
resource that I need? If so, how do I get it?

Thanks,

NS