+ Reply to Thread
Results 1 to 3 of 3

A Change class event

  1. #1
    Registered User
    Join Date
    01-19-2011
    Location
    Brazil
    MS-Off Ver
    Excel 2007
    Posts
    26

    A Change class event

    I got this form with lots of textboxes on it, and I have created a class module to attach an event to all of it. It worked fine so far, but I can't make the Enter event work.

    Here is the code in the class module called MatvChange:
    Please Login or Register  to view this content.
    And here is the code in the userform module:

    Please Login or Register  to view this content.
    Anyone knows why this is happening?

    Thanks in advance.

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: A Change class event

    Hello bagulhodoido,

    The new Class does not have have an Enter event. The new Class is built upon the existing TextBox Class. The Enter event is part of the OLE Object class which is the parent of the TextBox class. Unfortunately, VBA does not allow you to create your own class. Rather, it only allows you to copy and instantiate an existing class.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  3. #3
    Registered User
    Join Date
    01-19-2011
    Location
    Brazil
    MS-Off Ver
    Excel 2007
    Posts
    26

    Re: A Change class event

    Quote Originally Posted by Leith Ross View Post
    Hello bagulhodoido,

    The new Class does not have have an Enter event. The new Class is built upon the existing TextBox Class. The Enter event is part of the OLE Object class which is the parent of the TextBox class. Unfortunately, VBA does not allow you to create your own class. Rather, it only allows you to copy and instantiate an existing class.
    Could I, instead of declaring Changed as a textbox, declare it as an OLE Object?

    Also, If I use the Enter event inside the userform module it works. How is that?

    EDIT ----

    Leith, I have an enormous amount of controls in my userform. Setting the Enter event to each one of them is just unclever.

    Is there any other way to do it?
    Last edited by bagulhodoido; 07-17-2011 at 03:19 AM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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