+ Reply to Thread
Results 1 to 3 of 3

MSForms.CommandButton = User-defined Type not defined

  1. #1
    Valued Forum Contributor
    Join Date
    08-29-2012
    Location
    In lockdown
    MS-Off Ver
    Excel 2010 (2003 to 2016 but 2010 for choice)
    Posts
    1,766

    MSForms.CommandButton = User-defined Type not defined

    I have created a new workbook and I keep getting a compile error "User-defined Type not defined" on the line:
    Please Login or Register  to view this content.
    I have tried googling the net and the solutions I found ("Trust access to the VBA project object model", enable VBIDE tool reference library) have no effect.

    Can anyone help?
    *******************************************************

    HELP WANTED! (Links to Forum threads)
    Trying to create reusable code for Custom Events at Workbook (not Application) level

    *******************************************************

  2. #2
    Valued Forum Contributor
    Join Date
    08-29-2012
    Location
    In lockdown
    MS-Off Ver
    Excel 2010 (2003 to 2016 but 2010 for choice)
    Posts
    1,766

    Re: MSForms.CommandButton = User-defined Type not defined

    Solved. I provide the solution for anyone else who runs into this.

    One solution I found on the net stated "to enable tool reference library Microsoft Forms 2.0". However I opened my tool references and the library didn't exist! So I tried adding a new form to the VBA project. This caused the Microsoft Forms 2.0 library to appear in the new workbooks tool reference library.

    Now that the library was enabled in the workbook, the compile error disappeared.

  3. #3
    Registered User
    Join Date
    09-14-2012
    Location
    Ireland
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: MSForms.CommandButton = User-defined Type not defined

    I had a similar problem.
    Solution 1: I declared "Dim Btn as Object", not as MSForms.CommandButton.
    Solution 2: Move the line "Dim Btn as MSForms.CommandButton" after the UserForm variable has been declared AND set!
    Both solutions worked for me.
    Last edited by Antenne88; 04-30-2015 at 07:45 AM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] User-defined type not defined error
    By pacenvtechinc in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-01-2012, 04:21 PM
  2. User Defined type not defined error
    By Rodeoclown in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-17-2011, 06:10 PM
  3. compile error - user defined type not defined
    By TMP123 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-23-2010, 01:42 PM
  4. VB Compile Error - User-defined type not defined
    By dbwiz in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-08-2010, 04:31 PM
  5. User Defined type not defined Error
    By zwieback89 in forum Excel General
    Replies: 1
    Last Post: 02-22-2007, 04:19 AM

Tags for this Thread

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1