+ Reply to Thread
Results 1 to 5 of 5

AfterUpdate event in a Class Module

  1. #1
    Registered User
    Join Date
    07-09-2010
    Location
    Helsingborg, Sweden
    MS-Off Ver
    Excel 2010
    Posts
    26

    AfterUpdate event in a Class Module

    Is it possible to raise the AfterUpdate event of a TextBox in a class module?
    It's know it's not contained in the event list but there is maybe a workaround!

    Cheers
    Mats
    Last edited by Mats Samson; 01-08-2012 at 06:25 PM.

  2. #2
    Forum Expert OnErrorGoto0's Avatar
    Join Date
    12-30-2011
    Location
    I DO NOT POST HERE ANYMORE
    MS-Off Ver
    I DO NOT POST HERE ANYMORE
    Posts
    1,655

    Re: AfterUpdate event in a Class Module

    No it is not, I'm afraid. That event actually belongs to the parent Control, but you cannot declare a generic Control WithEvents. Perhaps if you can tell us what you are trying to do specifically, we can come up with a workaround (though it will almost certainly be a little convoluted).
    Good luck.

  3. #3
    Registered User
    Join Date
    07-09-2010
    Location
    Helsingborg, Sweden
    MS-Off Ver
    Excel 2010
    Posts
    26

    Re: AfterUpdate event in a Class Module

    I read somewhere that it was possible to use RaiseEvent, but I believe it was for VB!
    But basically I was trying to "compress" code putting several textbox AfterUpdates (quantity, purchase price, sales price, etc) in an order form in a Class module.
    The Change event seems to work but it doesn't look that nice when values are recalculated with every new digit you type instead of after (e.g. just before) the textbox lose focus.

  4. #4
    Forum Expert OnErrorGoto0's Avatar
    Join Date
    12-30-2011
    Location
    I DO NOT POST HERE ANYMORE
    MS-Off Ver
    I DO NOT POST HERE ANYMORE
    Posts
    1,655

    Re: AfterUpdate event in a Class Module

    Well there is a long discussion on MrExcel about a similar issue (it was about the Exit event, but the same principles will apply) in this thread and you may be able to adapt the code there to your situation. Alternatively, if you only have a few controls, just use one update routine that you call from each control - that will minimise the code to some degree, albeit not as succinctly as a class.

  5. #5
    Registered User
    Join Date
    07-09-2010
    Location
    Helsingborg, Sweden
    MS-Off Ver
    Excel 2010
    Posts
    26

    Re: AfterUpdate event in a Class Module

    Thanks,
    Yes, I think I'll do!
    I've found great fun in cutting code lines by using For.. To loops and especially if you're constructing (naming) variables, ranges and controls accurately you can just by passing an index from the control's real event procedure, control many events in a single "main" procedure.
    Thanks for the guidance!
    Regards
    Mats

+ 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