Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I recorded a macro that does a refresh on a SQL query cell. I can record it
OK (refresh works during record), but running it produces a "1004" error on the line that is attempting to refresh the query. Anyone know why this happens and how to fix it? Sheets("Sheet1").Visible = True Range("A2").Select Selection.QueryTable.Refresh BackgroundQuery:=False (1004 error) Range("A2").Select Selection.Copy Sheets("Data").Select Range("A15").Select ActiveSheet.Paste Sheets("Sheet1").Select ActiveWindow.SelectedSheets.Visible = False |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Querytables is a property of the Sheet object. So, if the query is in
Sheet1, try: Worksheets("Sheet1").QueryTables(1).Refresh BackgroundQuery:=False -- Hope that helps. Vergel Adriano "rick_mc" wrote: I recorded a macro that does a refresh on a SQL query cell. I can record it OK (refresh works during record), but running it produces a "1004" error on the line that is attempting to refresh the query. Anyone know why this happens and how to fix it? Sheets("Sheet1").Visible = True Range("A2").Select Selection.QueryTable.Refresh BackgroundQuery:=False (1004 error) Range("A2").Select Selection.Copy Sheets("Data").Select Range("A15").Select ActiveSheet.Paste Sheets("Sheet1").Select ActiveWindow.SelectedSheets.Visible = False |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
external data automatic refresh through macro/query | Excel Discussion (Misc queries) | |||
Refresh BackgroundQuery fails | Excel Programming | |||
Timing of automatic query refresh and macro pivot table refresh | Excel Programming | |||
Macro to execute on WEB Query Refresh | Excel Programming | |||
Web Query Refresh - Automatically Run Macro | Excel Programming |