Wednesday 24 December 2014

Excel - Macro - How to fix error: Compile error: User-defined type not defined

Watch this example on YouTube

I am getting this error while executing the following code:
Sub test()
    Dim con As ADODB.Connection
End Sub
To fix it
go to tools
go to References
select Microsoft ActiveX Data Object 2.8(or other) library

1 comment:

  1. i have issue in visual basic module. compile error (user defined type not found).

    ReplyDelete