Hello
I have an Excel workbook that always worked before but giving me an error message now: "run time error 1004 - general odbc error".
The code is (provided by Skip):
The code is halted at .Refresh False.
This workbook uses MS Query from data on another page to summarize data for this page. I recently upgraded to another computer.
Thanks for any assistance.
I have an Excel workbook that always worked before but giving me an error message now: "run time error 1004 - general odbc error".
The code is (provided by Skip):
Code:
Private Sub Worksheet_Activate()
Dim sConn As String, sSQL As String, sPath As String, sDB As String
sPath = ThisWorkbook.Path
sDB = Split(ThisWorkbook.Name, ".")(0)
sConn = "ODBC;DSN=Excel Files;"
sConn = sConn & "DBQ=" & sPath & "\" & sDB & ".xls;"
sConn = sConn & "DefaultDir=" & sPath & ";"
sConn = sConn & "DriverId=790;MaxBufferSize=2048;PageTimeout=5;"
With ActiveSheet
With .QueryTables(1)
.Connection = sConn
Debug.Print .CommandText
.Refresh False
End With
.Calculate
End With
End Sub
The code is halted at .Refresh False.
This workbook uses MS Query from data on another page to summarize data for this page. I recently upgraded to another computer.
Thanks for any assistance.