Link to home
Start Free TrialLog in
Avatar of RyanBank
RyanBank

asked on

error:User defined type not defined

Hi,

Please assist what could be missing, vb returns the error: User defined type not defined

pointing to the following line:
Private Function GetExcelConnection(ByVal Path As String, Optional ByVal Headers As Boolean = True) As Connection

Thanks.
Avatar of Brian Mulder
Brian Mulder
Flag of Netherlands image

Hi RyanBank,
----------

think its missing the reference to the connection type, the function returns a connection but where is Connection delcared?

----------
bruintje
Avatar of RyanBank
RyanBank

ASKER

bruintje,

here's the whole function with the connection type. what could be happening?

thanks.

Private Function GetExcelConnection(ByVal Path As String, Optional ByVal Headers As Boolean = True) As Connection
    Dim strConn As String
    Dim objConn As ADODB.Connection
    Set objConn = New ADODB.Connection
    strConn = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
              "Data Source=" & Path & ";" & _
              "Extended Properties=""Excel 8.0;HDR=" & _
              IIf(Headers, "Yes", "No") & """"
    objConn.Open strConn
    Set GetExcelConnection = objConn
End Function
ASKER CERTIFIED SOLUTION
Avatar of Brian Mulder
Brian Mulder
Flag of Netherlands image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
bruintje,

can you kindly assist, i'm out of luck on this one:

https://www.experts-exchange.com/questions/21920356/error-syntax-error-in-FROM-clause.html


thanks
sorry i was out with the family, but i see your problem was already solved