Auto Refresh Query Table
Try code like this
Sub refresh()
Set sht = ThisWorkbook.Sheets("sheet6")
For Each query In sht.QueryTables
query.refresh
Next query
End Sub
"Scotty9349" wrote:
I have a MS Query to retrieve data from an SQL server database through ODBC
Connection. Lets call this Spreadsheet 1.
I created a separate spreadsheet (Spreadsheet 2) that has a pull down menu
which links to Spreadsheet 1. When I use the link, Spreadsheet 1 does not
enable Automatic refresh. However, if I go directly to Spreadsheet 1, it will
prompt for refresh upon open.
Spreadsheet 2 is my personal spreadsheet, whereas Spreadsheet 1 is used by a
group of others.
Is it possible to write some code to refresh the MS Query when I open
Spreadsheet 1 from Spreadsheet 2?
Any insight would be greatly appreciated.
Thanks.
Scotty9349
|