Refresh Excel QueryTable using VBA
Hello,
I'm trying to refresh an existing query in a hidden sheet and keep that sheet hidden. The query uses an ODBC connection to an SQL database. The problem is that the SWL server requests the userid and password before completing the refresh. How can I clean this up and automatically feed ther connection srtring?
Private Sub update_inventory_Click()
Sheets("Invent").Visible = True
Sheets("Invent").Select
Selection.QueryTable.Refresh BackgroundQuery:=False
Sheets("Invent").Visible = False
End Sub
Thanks.
Thanks.
|