USERFORM: What is the difference between the Initialize and Activate routines?

2

What's the difference between using Initialize and Activate as a userForm's boot routine?

  • Private Sub UserForm_Initialize()
  • Private Sub UserForm_Activate()
  • asked by anonymous 27.04.2017 / 19:23

    2 answers

    3

    Initalize occurs only once in the form's entire execution so you can use, for example, to add items to a combo box, that is, to place codes that only need to be executed once before the form appears for the user. In the case of Activate, suppose you have to do a validation every time the form is activated, in which case you would use Activate since it always runs when the form is activated

        
    27.04.2017 / 20:25
    0

    Initialize occurs when the object (in your case the Form) is created . So the code runs only once . Activate occurs every time the form's Activate event occurs, that is, when it receives focus, or when it is displayed after it has been hidden, or any event that activates the object.

    MS Reference - Form .Activate Method

        
    13.11.2018 / 19:01