Thread: Query Error
View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Chad[_3_] Chad[_3_] is offline
external usenet poster
 
Posts: 32
Default Query Error

I get this error:
Run-time error '-2147417848 (80010108)

Automation error
The object invoked has disconnected from its clients

Here is my code. It crashes on the .Refresh BackgroundQuery:=False

Sub LoadAssays()
With ActiveSheet.QueryTables.Add(Connection:= _
"FINDER;\\Server1\data\Engineering\Assay.dqy", Destination:= _
Range("A1"))
.Name = "Assay"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlInsertDeleteCells
.SavePassword = True
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.PreserveColumnInfo = True
.Refresh BackgroundQuery:=False
End With
End Sub

Here is the situation. I run it once and it is fine. It loads everything
into a spreadsheet. I close the spreadsheet and then run it again and I get
this error. Do I need to 'close' the connection so I can re-establish it?
If so how do I do this.

Thanks a bunch, everyone here are a great help!
Chad