Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Query Error
hi,
this code adds a query. you need only to run it once. after the query has been created all you have to do after that is refresh the query. i am quessing but i think that you get the error becasue you are trying to create a new query on top of the old. and that is were the conflict occures. try this Sub RefreshQuery() activesheet.range("A1").QueryTable.Refresh BackgroundQuery:=False end sub i always recommend that brackground query not be run perticularly if you are going to be processing the data that the query is refreshing with more code. regards FSt1 "Chad" wrote: 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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
web query error | Excel Discussion (Misc queries) | |||
MS Query error | Excel Worksheet Functions | |||
MS query error | Excel Discussion (Misc queries) | |||
error using MS query | Excel Discussion (Misc queries) | |||
Run-query error | Excel Programming |