Retrieve Current Controls Event

  • Dear all


    Is it possible to retrieve the current control's type of event?
    Is it an Enter or Exit event?


    For example:



    I know that it is possible to retrieve the current control's name - how about the type of action?


    Thanks


    Maria

  • Re: Retrieve Current Controls Event


    As you are running the event then


    Code
    Dim TypeOfAction As String 
     
    Private Sub txtDate_Enter 
        TypeOfAction = "Enter"
    End Sub 
     
    Private Sub txtDate_Exit(ByVal Cancel As MSForms.ReturnBoolean) 
        TypeOfAction = "Exit"
    End Sub


    Or do you mean something else?

  • Re: Retrieve Current Controls Event


    yes, sorry Roy
    what I meant was whether it is possible to determine the type of event handler; without me having to hardcode it.
    in my example, the sub would automatically determine TypeOfAction as being an exit handler.


    If it is possible to retrieve the sub's name, I could put it into a string and check whether it has the word "_exit" in it.

  • Re: Retrieve Current Controls Event


    I don't understand how you would use this if at all possible. Chip Pearson's site has an in depth look at the coding the VB Editor

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!