+ Reply to Thread
Results 1 to 4 of 4

Form Class

  1. #1
    Forum Contributor
    Join Date
    07-23-2016
    Location
    Texas
    MS-Off Ver
    2016
    Posts
    273

    Form Class

    I am trying to use a Form as a class module by adding properties and methods. However, didn't get very far as the below gives an error "Object Doesn't Support Property or Method". What is wrong with the code?

    Please Login or Register  to view this content.
    and in the Form Code under "General" I have:

    Please Login or Register  to view this content.

  2. #2
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Form Class

    UserForm is a class. To create an object, you to instantiate it (an instance of the class). You can then access its members(Properties and methods)

    Dim f As UserForm
    Set f = New UserForm

  3. #3
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229

    Re: Form Class

    in the code module for the user form frm_Message
    put this code.

    Please Login or Register  to view this content.

    Then in the calling routine, the syntax would be

    Please Login or Register  to view this content.
    One of your problems is that the (write only) SetTitle property doesn't do anything other than set the msg variable. As written, it doesn't effect any of the controls.
    _
    ...How to Cross-post politely...
    ..Wrap code by selecting the code and clicking the # or read this. Thank you.

  4. #4
    Forum Contributor
    Join Date
    07-23-2016
    Location
    Texas
    MS-Off Ver
    2016
    Posts
    273

    Re: Form Class

    Thanks...it was the dim as the user form name "frm_Message" instead of "userform" that was needed.

+ 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. Pasteing from Clipboard Runtime error 1004: Paste method of worksheet class failed
    By Ozman89 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-12-2016, 03:29 PM
  2. “= 1st class’ lower class limit + class width"
    By CheeseFace in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 09-06-2016, 08:21 PM
  3. [SOLVED] Form Class not supported in VBE/can't be loaded. Can this be converted?
    By mc84excel in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 07-03-2014, 12:10 PM
  4. [SOLVED] Class Newbie question #2 - Check if Class already loaded/set?
    By mc84excel in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 04-16-2014, 06:59 PM
  5. class foactory cannt supply requested class
    By rakeshkaduskar in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 12-26-2012, 02:00 PM
  6. [SOLVED] ComboBox class .AddItem filled in class module
    By Jacques Grobler in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 07-03-2012, 05:48 AM
  7. User Form Problem - Autofilter Method of Range class failed
    By maneesh.dhabria in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-29-2009, 08:10 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