I have an excel spreadsheet that imports data from SQL Server via the Import External Data query. I want to change the server, but can't find anything on how to do this.
Edit the query. In the QBE grid, just Edit/Return data to Excel. Turn off the recorder.
alt+F11 to toggle between the VB Editor and the active sheet.
In the VB Editor observe your recorded code. You will see a Connection parameter with text that is assigned. This is where your server is specified. Change accordingly.
If you need help customizing your code, please post back with your code, in VBA Visual Basic for Applications (Microsoft) Forum707.
As a matter of practice, I code almost all my MS Query queries this way. There's always a chance that a server will change. If others run the query, they often have servers mapped to different drives. You can assure that the server connection be drive-independent, via the connect string.
But the short answer is, no, there is nothing else that needs to be done.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.