Hi,
I have multiple worksheets which each call a separate MSQUERY statement. I recorded a Macro and I have placed a refresh button in the spreadsheet to call this macro automatically refresh the document but it asks me to enter my username and password to the SQL Server connection for every worksheet that calls a MSQuery.
An example of the calls in the macro would be.
Sheets("Accomodation Items").Select
Selection.QueryTable.Refresh BackgroundQuery:=False
Sheets("Consumables").Select
Selection.QueryTable.Refresh BackgroundQuery:=False
Sheets("Other Services").Select
Range("A3").Select
Selection.QueryTable.Refresh BackgroundQuery:=False
Range("B31").Select
I wish to be able to pass the connection details to the ODBC in here so that I do not have to log into every worksheet to get a result.
Regards,
Redmoo
I have multiple worksheets which each call a separate MSQUERY statement. I recorded a Macro and I have placed a refresh button in the spreadsheet to call this macro automatically refresh the document but it asks me to enter my username and password to the SQL Server connection for every worksheet that calls a MSQuery.
An example of the calls in the macro would be.
Sheets("Accomodation Items").Select
Selection.QueryTable.Refresh BackgroundQuery:=False
Sheets("Consumables").Select
Selection.QueryTable.Refresh BackgroundQuery:=False
Sheets("Other Services").Select
Range("A3").Select
Selection.QueryTable.Refresh BackgroundQuery:=False
Range("B31").Select
I wish to be able to pass the connection details to the ODBC in here so that I do not have to log into every worksheet to get a result.
Regards,
Redmoo