ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Open UserForm (https://www.excelbanter.com/excel-programming/434464-open-userform.html)

Tony Bender

Open UserForm
 
I have an application consisting of a report menu and the
corresponding templates the menu points to.

The menu is a UserForm (UF1) and resides on a separate workbook
(Wkbk1). When the user opens Wkbk1 it automatically opens UF1. The
user then selects a report template from one of 4 OptionButtons. The
resulting template (example; Rpt1.xls) opens up. The user can exit
this report by clicking on the Exit button (triggers the ExitApp macro
which closes the activewindow).

My problem is when I click on the Exit button it closes the
application OK, but instead of opening the menu (UF1) it simply opens
the sole empty worksheet in Wkbk1. I want this to automatically open
the UF1 instead of displaying the empty worksheet.

I tried entering the following code onto the worksheet in the VBE
under the VBA Project
Private Sub Workbook_Open()
Load UF1
UF1.Show
End Sub

But no luck

Can this be done? If so I need help understaning the correct code to
do this.

Thank you,

JLGWhiz[_2_]

Open UserForm
 
You need to put this portion of your code:


UF1.Show

in the exit macro right before End Sub.


"Tony Bender" wrote in message
...
I have an application consisting of a report menu and the
corresponding templates the menu points to.

The menu is a UserForm (UF1) and resides on a separate workbook
(Wkbk1). When the user opens Wkbk1 it automatically opens UF1. The
user then selects a report template from one of 4 OptionButtons. The
resulting template (example; Rpt1.xls) opens up. The user can exit
this report by clicking on the Exit button (triggers the ExitApp macro
which closes the activewindow).

My problem is when I click on the Exit button it closes the
application OK, but instead of opening the menu (UF1) it simply opens
the sole empty worksheet in Wkbk1. I want this to automatically open
the UF1 instead of displaying the empty worksheet.

I tried entering the following code onto the worksheet in the VBE
under the VBA Project
Private Sub Workbook_Open()
Load UF1
UF1.Show
End Sub

But no luck

Can this be done? If so I need help understaning the correct code to
do this.

Thank you,




Rob Jordan

Open UserForm
 
You can hook the Workbook_WindowActivate event in Wkbk1 to show the form again:

Private Sub Workbook_WindowActivate(ByVal Wn As Window)
UF1.Show
End Sub

--
Powered by Creative Laziness


"Tony Bender" wrote:

I have an application consisting of a report menu and the
corresponding templates the menu points to.

The menu is a UserForm (UF1) and resides on a separate workbook
(Wkbk1). When the user opens Wkbk1 it automatically opens UF1. The
user then selects a report template from one of 4 OptionButtons. The
resulting template (example; Rpt1.xls) opens up. The user can exit
this report by clicking on the Exit button (triggers the ExitApp macro
which closes the activewindow).

My problem is when I click on the Exit button it closes the
application OK, but instead of opening the menu (UF1) it simply opens
the sole empty worksheet in Wkbk1. I want this to automatically open
the UF1 instead of displaying the empty worksheet.

I tried entering the following code onto the worksheet in the VBE
under the VBA Project
Private Sub Workbook_Open()
Load UF1
UF1.Show
End Sub

But no luck

Can this be done? If so I need help understaning the correct code to
do this.

Thank you,


Tony Bender

Open UserForm
 
On Oct 2, 3:01*pm, "JLGWhiz" wrote:
You need to put this portion of your code:

* *UF1.Show

in the exit macro right before End Sub.

"Tony Bender" wrote in message

...



I have an application consisting of a report menu and the
corresponding templates the menu points to.


The menu is aUserForm(UF1) and resides on a separate workbook
(Wkbk1). *When the user opens Wkbk1 it automatically opens UF1. *The
user then selects a report template from one of 4 OptionButtons. *The
resulting template (example; Rpt1.xls) opens up. *The user can exit
this report by clicking on the Exit button (triggers the ExitApp macro
which closes the activewindow).


My problem is when I click on the Exit button it closes the
application OK, but instead of opening the menu (UF1) it simply opens
the sole empty worksheet in Wkbk1. *I want this to automaticallyopen
the UF1 instead of displaying the empty worksheet.


I tried entering the following code onto the worksheet in the VBE
under the VBA Project
Private Sub Workbook_Open()
* Load UF1
* UF1.Show
End Sub


But no luck


Can this be done? * If so I need help understaning the correct code to
do this.


Thank you,- Hide quoted text -


- Show quoted text -


Thanks, I tried this but still no luck...

Thanks anyway...

Tony Bender

Open UserForm
 
On Oct 2, 3:43*pm, Rob Jordan
wrote:
You can hook the Workbook_WindowActivate event in Wkbk1 to show the form again:

Private Sub Workbook_WindowActivate(ByVal Wn As Window)
* * UF1.Show
End Sub

--
Powered by Creative Laziness



"Tony Bender" wrote:
I have an application consisting of a report menu and the
corresponding templates the menu points to.


The menu is aUserForm(UF1) and resides on a separate workbook
(Wkbk1). *When the user opens Wkbk1 it automatically opens UF1. *The
user then selects a report template from one of 4 OptionButtons. *The
resulting template (example; Rpt1.xls) opens up. *The user can exit
this report by clicking on the Exit button (triggers the ExitApp macro
which closes the activewindow).


My problem is when I click on the Exit button it closes the
application OK, but instead of opening the menu (UF1) it simply opens
the sole empty worksheet in Wkbk1. *I want this to automaticallyopen
the UF1 instead of displaying the empty worksheet.


I tried entering the following code onto the worksheet in the VBE
under the VBA Project
Private Sub Workbook_Open()
* *Load UF1
* *UF1.Show
End Sub


But no luck


Can this be done? * If so I need help understaning the correct code to
do this.


Thank you,- Hide quoted text -


- Show quoted text -


I tried this as well, but still no luck...

Thank you anyway


All times are GMT +1. The time now is 12:30 PM.

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