Automation Error:
I am getting the error in the attached screenshot. I'm using Excel 2003 with a macro that runs VB script. The script is supposed to get data from an SQL 08 database.
The exact error is:
--------------------------------------------------------------------
Run-time error '-2147417848 (80010108)':
Automation error
The object invoked has disconnected from its clients.
--------------------------------------------------------------------
When i debug, i get brought to the section of (obviously I have changed the username and password in the connection string for security reasons):
Sub GetData()
With ActiveSheet.QueryTables.Add(Connection:=Array(Array( _
"ODBC;DSN=Vendor;UID=<userid>;PWD=<password>;DBQ=\\computer1\Folder1\Folder 2\Folder3\;CODEPAGE=1252;DictionaryMode=0;StandardMode=1;Ma" _
), Array("xColSupport=1536;ShortenNames=0;DatabaseType=1;")), Destination:= _
Range("A1"))
.CommandText = Array("SELECT * FROM ""APM_MASTER__VENDOR""")
.Name = "Vendor (not sharable)"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlInsertDeleteCells
.SavePassword = True
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.PreserveColumnInfo = True
.SourceConnectionFile = _
"C:\Program Files (x86)\Common Files\ODBC\Data Sources\Vendor (not sharable).DSN"
.Refresh BackgroundQuery:=True
End With
End Sub
I'm STUCK! any help is appreciated! Thank you very much!!!!
Attached Images
At what point do you get the error? Also, why is the table name in quotes?
Posting Permissions
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
Forum Rules