Runtime error - method open of object connection failed

  • I am getting the error message at the line in the below code snippet.

    Any idea on resolving this issue?

     Conn1.Open sconnect
     Dim Conn1 As ADODB.Connection
       Dim rs As ADODB.Recordset
       Dim mCmd As ADODB.Command
       DBPath = ws.Parent.FullName
       sconnect = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & DBPath & ";Extended Properties=""Excel 12.0 XML;HDR=Yes;IMEX=1"";"
        Set Conn1 = New ADODB.Connection
       Conn1.Open sconnect

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!