vba - Embedded MS Query connection in Excel -


the original task had combine 2 worksheets dynamically. discovered microsoft query lets me building queries pull data worksheets. however, data connection stored in file has references local computer. there way make "embedded" in file instead, such can share file , can refresh it? here's connection string.

dsn=excel files;dbq=c:\users\nana\documents\model\project x model - draft 2015 07 13 0410 - copy.xlsx;defaultdir=c:\users\nana\documents\model;driverid=1046;maxbuffersize=2048;pagetimeout=5; 

i think can set dsn in code should work

currentdir = replace(wscript.scriptfullname,wscript.scriptname,””)  

which give directory excel file run , can change dns params reflect variable:

dsn=excel files;dbq=" & currentdir & "source.xls;defaultdir=" & currentdir & ";driverid=1046;fil=excel 12.0;maxbuffersize=2048;pagetimeout=5; 

that should mean dsn references same workbook...

*edit should mention came here http://www.experts-exchange.com/software/office_productivity/office_suites/ms_office/excel/q_26514035.html


Comments

Popular posts from this blog

user interface - how to replace an ongoing process of image capture from another process call over the same ImageLabel in python's GUI TKinter -

javascript - Restarting Supervisor and effect on FlaskSocketIO -

javascript - Using jquery append to add option values into a select element not working -