Loading an Excel User Form

A

AccessHelp

Hi,

I created an Excel user form and renamed it to "frmFormA". I want the user
form to show when I open the workbook. I use the following code in the
"ThisWorkbook" section of Microsoft Excel Objects in Visual Basic:

Private Sub loadWb()
Load UserForm1
UserForm1.Show
End Sub

I also tried to change the code to "frmFormA" in place of "UserForm1" in the
code. For some reason, none of them works.

Can someone help me with my problem?

Thanks.
 
J

John Bundy

you need to put it in the workbook_open event

Private Sub Workbook_Open()
Load frmFormA
frmFormA.Show
End Sub
 
I

Incidental

hi there

if you put the code below in the "ThisWorkbook" module it should work
for you, you need to put the code in the workbook open event for it to
run when the workbook opens. you can select from the built in events
for an object by using the two comboboxes at the top of the code pane.

Private Sub Workbook_Open()
frmFormA.Show vbModal
End Sub


hope this helps you out

Steve
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top