I am trying to connect to SQL server using excel, but i am getting the following error:
Provider cannot be found. It may not be properly installed.
Public Const gszCONNECTION As String = _
"Provider=SQLOLEDB;Data Source=localhost;" & _
"Initial Catalog=Northwind;Integrated Security=SSPI"
Public gobjCmd As ADODB.Command
Public gobjConn As ADODB.Connection
Public Sub CreateConnection()
' Create the Connection object.
Set gobjConn = New ADODB.Connection
It fails when it tries to call this line: gobjConn.Open gszCONNECTION
I have added Microsoft ADO 2.5 in the refrences section in the VBA editor.
I have also run the Microsft MDAC checked tool, and it tells me that the latest version is MDAC 2.8
I do'nt know what else i can do to fix this issue.