View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.misc
Matt Colegrove Matt Colegrove is offline
external usenet poster
 
Posts: 5
Default Changing data source on ODBC query

I just found a workaround for this.

Open the worksheet and place the cursor on a cell within the cell range of
the query. Press Alt-F11 to open the VBEditor. Press Ctrl-G to open the
Intermediate window. Type the command: ? ActiveCell.QueryTable.Connection.
The embedded connection string will be echoed back to the screen. Put double
quotes around the string and update the connection information with the new
server info. Move the cursor to the beginning of the connection string and
insert the following in front of the string:

ActiveCell.QueryTable.Connection =

Move the cursor to the end of the string and press enter. This will store
the updated connection string back into the worksheet. Try your query now.

Repeat for any other embedded queries in your worksheet.



"Aussie CPA" wrote:

Hi,
Can anyone tell me if it is possible to change the datasource on an ODBC
query set-up within excel?
Can this be done with code?
If so can anyone suggest some code?

Thanks.