I can't understand why:-
Sub Macro11()
'
' Macro11 Macro
'
'
Sheets("Sheet1").Select
Selection.ListObject.QueryTable.Refresh BackgroundQuery:=False
End Sub
works
Whilst:-
Sub GetQuery(sheetName As String)
With Sheets(sheetName)
.ListObject.QueryTable.Refresh BackgroundQuery:=False
End With
End Sub
gives an error message "Object does not support this property or method."
The first code was from a macro and the second is my attempt to avoid select. SheetName is "Sheet1"
I suspect that this error points to a basic lack of understanding that I have, so I would very much appreciate being put back on my rails!
John
Bookmarks