May 02 2019 11:20 AM
Hi All,
I'm experiencing an issue with a workbook I've created that has VBA code embedded to refresh an OLEDB connection to SQL Server. This all works fine on computers with Excel 2013, but I have a user on Excel 2010 and it is not working on their computer.
The error message is:
"Run time error: '-2147417848 (80010108)': Method 'Refresh' of object 'WorkbookConnection' failed"
The code is:
With ActiveWorkbook.Connections("worksheet").OLEDBConnection
.Connection = Array( _
"OLEDB;Provider=SQLOLEDB.1;Persist Security Info=True;User ID=User;Password=Password;Initial Catalog=InitialTable;Data Source=ServerName;" _
, _
"Use Procedure for Prepare=1;Auto Translate=True;Packet Size=4096;Workstation ID=A1234;Use Encryption for Data=False;Tag with " _
, "column collation when possible=False")
.SavePassword = True
.CommandText = "select * from query"
ActiveWorkbook.Connections("worksheet").Refresh
End With
Any help or suggestions appreciated.
Thanks.