Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Refresh Query on open failing
I'm getting a 1004 error when I try to refresh a query as I open a
Workbook using code. The field named "LicActiveQuery" IS at at the top right of the table that the query refreshes. Shouldn't I be able to use a named range rather than a row col number as long as it is within the query result table? On Error Resume Next Set wkbk = Workbooks("B.xls") On Error GoTo 0 If wkbk Is Nothing Then Set wkbk = Workbooks.Open(Filename:="C:\Data\ClientName \B.xls") 'RANGE ERROR Creates an "Run-time error '1004': ' "Method 'Range' of object'_Worksheet' failed Range("LicActiveQuery").QueryTable.Refresh BackgroundQuery:=False End If Thanks, Dennis |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Refresh Query on open failing
Try referring to the query table rather than a range:
yoursheet.QueryTables(1).Refresh BackgroundQuery:=False Cliff Edwards |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Workbook Open bypasses Query Refresh | Excel Programming | |||
Unable to open after auto refresh(Query) | Excel Discussion (Misc queries) | |||
Data query failing | Excel Worksheet Functions | |||
Refresh business query on open | Excel Discussion (Misc queries) | |||
Auto Open file VBA Refresh MS Query Save Close | Excel Programming |