Consulting

Results 1 to 5 of 5

Thread: Compile Error

  1. #1

    Compile Error

    I keep getting a compile error user defined type not defined

    I have read over and over about dim in the excel help and cannot see what is wrong. It always seems to be a dim statement
    Here is a copy of one such statement.

    Dim cnt As ADODB.Connection

  2. #2
    Site Admin
    Jedi Master
    VBAX Guru Jacob Hilderbrand's Avatar
    Joined
    Jun 2004
    Location
    Roseville, CA
    Posts
    3,712
    Location
    You need to set a reference (Tools | References) to Microsoft ActiveX Data Objects #.# Library. #.# will be some number based on your application version. Just choose the highest numbered reference to add.

  3. #3
    Moderator VBAX Master geekgirlau's Avatar
    Joined
    Aug 2004
    Location
    Melbourne, Australia
    Posts
    1,464
    Location
    This object is not a default option for Excel code, so you need a reference to the ADODB object. In the VBA window, select Tools, References, "Microsoft ActiveX Data Objects Library" (there will be a version number there - use the latest version available).

    Oops - beat me to it Jake!

  4. #4
    Site Admin
    The Princess VBAX Guru Anne Troy's Avatar
    Joined
    May 2004
    Location
    Arlington Heights, IL
    Posts
    2,530
    Location
    Girl: I wrote you off. SO GLAD TO SEE YOU AGAIN!!! (seriously!!)
    ~Anne Troy

  5. #5
    Moderator VBAX Master geekgirlau's Avatar
    Joined
    Aug 2004
    Location
    Melbourne, Australia
    Posts
    1,464
    Location
    Glad to be back - just bought a "renovator's delight" (aka dump) that is taking up most of my spare time

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •