ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Loading an Excel User Form (https://www.excelbanter.com/excel-programming/400832-loading-excel-user-form.html)

AccessHelp

Loading an Excel User Form
 
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.

John Bundy

Loading an Excel User Form
 
you need to put it in the workbook_open event

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


--
-John
Please rate when your question is answered to help us and others know what
is helpful.


"AccessHelp" wrote:

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.


Incidental

Loading an Excel User Form
 
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


AccessHelp

Loading an Excel User Form
 
Hi guys,

Thanks for your helps. They work perfectly.

"Incidental" wrote:

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




All times are GMT +1. The time now is 01:43 PM.

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