ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Userform_Initialize event failing to be called (https://www.excelbanter.com/excel-programming/293244-userform_initialize-event-failing-called.html)

R Avery

Userform_Initialize event failing to be called
 
Suppose i have the following code:


sub MySub()
Load frmMyForm

' actions

Unload frmMyForm
end Sub


Further assume that this code executes without Breaking or otherwise
failing to execute the last statement. How come VBA often does not
raise the UserForm_Initialize event when i "Load frmMyForm"? Am I
missing something?

Peter atherton

Userform_Initialize event failing to be called
 
The initialize event is in the workbook module use it to
load the form but do not include any further code.

Sub MySub()
Load frmMyForm
End Sub

The unLoad function is assigned to a close command button
on the form.

Include any code for the various textboxes etc within the
form module. Double click and control to start the code
for the control. These are all Private

Regards
Peter

-----Original Message-----
Suppose i have the following code:


sub MySub()
Load frmMyForm

' actions

Unload frmMyForm
end Sub


Further assume that this code executes without Breaking

or otherwise
failing to execute the last statement. How come VBA

often does not
raise the UserForm_Initialize event when i "Load

frmMyForm"? Am I
missing something?
.


Tom Ogilvy

Userform_Initialize event failing to be called
 
Sub Tester5()
For i = 1 To 10
cnt = i
Load frmMyForm

' actions

Unload frmMyForm
Next i

End Sub

fired every time for me.

--
Regards,
Tom Ogilvy


"R Avery" wrote in message
...
Suppose i have the following code:


sub MySub()
Load frmMyForm

' actions

Unload frmMyForm
end Sub


Further assume that this code executes without Breaking or otherwise
failing to execute the last statement. How come VBA often does not
raise the UserForm_Initialize event when i "Load frmMyForm"? Am I
missing something?





All times are GMT +1. The time now is 07:31 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com