ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Change database in Excel (https://www.excelbanter.com/excel-discussion-misc-queries/85321-change-database-excel.html)

Catarina

Change database in Excel
 
Hi.
I have two databases that are similar, and i have created an Excel document
that imports data from one database.
My problem is that i want to change the database of the document
programatically. I think that creating a macro in VBA the problem is solved.
But i don't know how to do it.
Anyone have any idea?
Thanks
Catarina

Ardus Petus

Change database in Excel
 
dim qt=Activesheet.querytables(1)
qt.connection = blah
qt.sql = blah

HTH
--
AP

"Catarina" a écrit dans le message de
...
Hi.
I have two databases that are similar, and i have created an Excel

document
that imports data from one database.
My problem is that i want to change the database of the document
programatically. I think that creating a macro in VBA the problem is

solved.
But i don't know how to do it.
Anyone have any idea?
Thanks
Catarina





All times are GMT +1. The time now is 05:26 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com