Incomplete Datasource Error when Queryinf Another Workbook

JeffK627

Active Member
Joined
Jun 22, 2005
Messages
313
I have the following VBA code which is failing with an "incomplete datasource" error on the last line:

Code:
Application.ScreenUpdating = False
Worksheets(Import).Select
Range("F10").Select
Selection.ListObject.QueryTable.Refresh BackgroundQuery:=False

The name of the ListObject is Table_Query_from_Excel_Files, and it is a table on the "Import" worksheet that pulls data from another workbook. The properties for the connection are as follows:

Code:
DSN=Excel Files;DBQ=\\wmssvcprd1\pf\BQ\College Point\PPP\PPP Capability\Programs.xlsx;DefaultDir=B:\;DriverId=1046;MaxBufferSize=2048;PageTimeout=5;

I have checked and the file referred to does exist, is in the right directory and has data. I didn't write this, but I need to maintain it and I'm not quite sure how to proceed to troubleshoot this code. Any help will be much appreciated!
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off

Forum statistics

Threads
1,214,424
Messages
6,119,407
Members
448,894
Latest member
spenstar

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top