What is wrong with this
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?? -- bach ------------------------------------------------------------------------ bach's Profile: http://www.excelforum.com/member.php...o&userid=26134 View this thread: http://www.excelforum.com/showthread...hreadid=402924 |
All times are GMT +1. The time now is 07:24 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com