running a userform without opening the VB editor

V

veggiesaregood

Is there a way I can get a userform to run without having to open up
the VB editor and run it. More specifically, I would like to get the
userform to run when I open up the Excel file it is in. Right now, I
have to open up the Excel file and then open up the VB editor and then
run the userform.

Any advice would be greatly appreciated.

Thanks!
 
J

JE McGimpsey

Is there a way I can get a userform to run without having to open up
the VB editor and run it. More specifically, I would like to get the
userform to run when I open up the Excel file it is in. Right now, I
have to open up the Excel file and then open up the VB editor and then
run the userform.

Any advice would be greatly appreciated.

One way:

Assume your Userform is named MyUserForm.

Put this in the ThisWorkbook code module of your file:

Private Sub Workbook_Open()
Dim frmMyForm As MyUserForm
Set frmMyForm = New MyUserForm
frmMyForm.Show
End Sub
 
Top