Connection String for MS query read only

deadlyliquidx

New Member
Joined
Feb 6, 2015
Messages
27
Hi,
I am using MS query and SQL syntax to update a pivot that reads the worksheets sheets within the same workbook.
Now I know that this works perfectly when the files that the query is reading off a seperate closed workbook but I need to have that workbook open. Is there something I can add to the connection string to allow this?
I tried readonly=0 and then false and then 1 and true and all variations,
the fact that I cant read internally from the workbook is the only major snag, can someone tell me what-else to add.
here is the string:

DBQ=C:user\blah\thisfile.xlsm;Driver={Microsoft Excel Driver (*.xls, *.xlsx, *.xlsm, *.xlsb)};DriverId=1046;FIL=excel 12.0;MaxBufferSize=2048;PageTimeout=5;

Also if the DBQ can be made dynamic to read the files current name and path (without VBA but I will do VBA if need be, that be great too) thanks!
 

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.

Forum statistics

Threads
1,215,059
Messages
6,122,918
Members
449,093
Latest member
dbomb1414

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