Setting the connection string to a QueryTable.refresh

C

Candyman

I use code to add new tables, but now I sinply want to refresh the table. So
the connection string has been tested.


'******** Refresh the data **********************************
'On Error GoTo ResetTitles
' With ActiveSheet.QueryTables.add(Connection:=ConnectString,
Destination:=Range(DataTarget), Sql:=mySQL)
' .Refresh BackgroundQuery:=False
' End With
' On Error GoTo 0


What is the syntax for getting the connection string to work with the
refresh? This won't work.

For Each oSheet In Worksheets
For Each QT In oSheet.QueryTables
QT.Refresh Connection:=ConnectString, BackgroundQuery:=False '
Next QT
Next oSheet
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top