R
rick_mc
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
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