What is wrong with this

B

bach

Private Sub Workbook_Activate()

Dim sqlstring As String
Dim connstring As String


Sheets("Sheet2").Select
Range("A1").Select

sqlstring = "SELECT statemet"

connstring = "ODBC;DSN=Sales;UID=;PWD=;DATABASE=Sales"

With ActiveSheet.QueryTables.Add(Connection:=connstring,
Destination:=Range("Sheet2!$A$1"), Sql:=sqlstring)
..RefreshPeriod = 0
End With

End Sub

User name and password has been removed. I throught
Application.ScreenUpdating = False should work but it does not any
idears??
 

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