+ Reply to Thread
Results 1 to 3 of 3

Trapping Userform Events

  1. #1
    Registered User
    Join Date
    11-26-2008
    Location
    San Francisco
    Posts
    33

    Trapping Userform Events

    I'm trying to trap the events of a user form in a class of mine. At the top of my class I have the standard:

    Please Login or Register  to view this content.
    I'm able to trap most events but unfortunately VBA doesn't seem to display the events I'm actually looking for:

    UserForm_Resize
    UserForm_Terminate
    UserForm_Initialize

    Are Initialize/Terminate events as well as class constructors/destructors?

    Why am I not able to trap Resize?

    I came up with a workaround wherein I define my own events within my userform class definition, raise the events within the UserForm code, and then trap them in my class. Like this:

    Please Login or Register  to view this content.
    Is there a way to directly trap the Resize event in my class or should I continue with my workaround?

    Thanks,
    negcx
    Last edited by negcx; 01-09-2009 at 04:58 PM.

  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
    Hello negcx,

    The Resize event isn't made available in a sub-classed UserForm because of how VBA communicates with the UserForm. Once you sub-class the UserForm in VBA you only have access to the client portion of the UserForm. Resize, Initialize, and Terminate are part of the non-client portion of the UserForm. VBA grants you access to these functions at design time since this part of the windows creation API.

    Sincerely,
    Leith Ross

  3. #3
    Registered User
    Join Date
    11-26-2008
    Location
    San Francisco
    Posts
    33
    Thanks, I guess I'll implement it by throwing another event.

+ 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