Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Calling UserForm_Initialize() in a Module

How can I call UserForm_Initialize() in a Module instead of the UserForm code object?

like image 546
4 Leave Cover Avatar asked Dec 20 '12 03:12

4 Leave Cover


People also ask

How do I open a UserForm in Excel?

Create Button to open UserForm In the centre of the worksheet, draw a rectangle, and format as desired. Go to the Excel window, and click the button, to open the UserForm.


1 Answers

From a module:

UserFormName.UserForm_Initialize

Just make sure that in your userform, you update the sub like so:

Public Sub UserForm_Initialize() so it can be called from outside the form.

Alternately, if the Userform hasn't been loaded:

UserFormName.Show will end up calling UserForm_Initialize because it loads the form.

like image 51
Daniel Avatar answered Sep 30 '22 11:09

Daniel