Querytables refresh gives Subscript out of Range Error

F

Fid

In Excel 2007 I have the very simple code (abridged for clarity):

Private Sub cmdRefreshRMTable_Click()
With Workbooks("RM_Master.xls").Worksheets("ESC_RM_Cost")
.QueryTables(1).Refresh BackgroundQuery:=False
End With
End Sub

that gives me a subscript out of range error on the refresh method.
The workbook name is spelled correctly, the worksheet name is spelled
correctly and there is only one query table in the entire workbook.

In Excel 2003 this same code works properly.

What am I missing?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top