Re: UserForm Is A Class




>
> "With myForm" will do an implicit Load, firing the Initialize event. So
> you don't need "Load myForm". In fact, I can't think of a case where the
> Load command is needed to ensure that you can separate the Initialize and
> Activate events.
>

I think the Load statement is a carry-over from VB, where there is a clear
distinction between creating the form as a class object and creating it as a
graphic object. In VB, when you instantiate the form object (eg set x = new
Myform), the 'class' components are created in memory, but the GUI elements
(the form as a graphic object, and its controls) are not. The GUI part is
loaded automatically (and the Load event fired) when you show the form or
refer to any control. The Load method is sometimes useful if you want to
force the GUI components to load -- eg to initialize their values -- without
showing the form or refering to any specific control.

But as you say, it's hard to think of a reason to use it in VBA.


.



Relevant Pages

  • Re: UserForm Is A Class
    ... assume the using "Load" is the correct in a situation like your example. ... Load myForm ... > Private Sub UserForm_Activate ... > Private Sub UserForm_Deactivate ...
    (microsoft.public.word.vba.general)
  • Re: UserForm Is A Class
    ... I have a simple userform with one command button. ... I see the behaviour that you point out about Load and Show and wil then ... Load myForm ... the Unload is done implictly when then routine ends and the ...
    (microsoft.public.word.vba.general)
  • Re: UserForm Data Validation. I tried and tried but cant figure it out.
    ... Unload MyForm is the same as Set MyForm=Nothing ... Load MyForm is the same as Set MyForm = New DINGOFORM1 ... I don't know what he means by "magic forms support." ...
    (microsoft.public.word.vba.general)
  • Re: "Loading..." Splash Screen in Excel
    ... I f your form is named MyForm, ... will load your form into memory. ... >> Instead of running the macro, load the form and have the form run the ...
    (microsoft.public.excel.programming)
  • Re: re-entering userform
    ... not created and the initialize event is not run. ... > userform and a button that opens up another userform that loads the ... > Data>Form with text boxes that each load a specific cell in a row. ... it just loads the First set of data instead. ...
    (microsoft.public.excel.programming)