Are you sure the ExitApp macro you placed in your workbook Rpt1.xls
actually works without error? It seems to me that the UserForm UF1 in
that context...

Anyhow I think you can accomplish what you are trying to do simply by
placing the following event handler into the ThisWorkbook VBA module
of your workbook Wkbk1:

Private Sub Workbook_Activate()
    UF1.Show vbModeless
End Sub

Once you did that you can remove the Workbook_Open event handler you
posted and UF1 will show after you closed Rpt1.

Hope this helped,
Rolf

On Oct 7, 9:03 am, Tony Bender <tony_ben...@yahoo.com> 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 the
> UserForm (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).
>
> Here is the ExitApp macro:
> Private Sub ExitApp()
>    Application.DisplayAlerts = False
>    Application.ActiveWorkbook.Saved = False
>    Application.ActiveWorkbook.Close
>    UF1.Show
> End Sub
>
> My problem is when I click on the Exit button on Rpt1 it closes the
> workbook 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've tried the following code but with no luck, and I appreciate any
> ideas as I am losing patience!
>
> In Wkbk1 I have this code:
>
> Private Sub Workbook_Open()
>    Load UF1
>    UF1.Show vbModeless
> End Sub
>
> Also, in the UserForm itself when the user selects one of the 4
> OptionButtons here is the corresponding code:
>
> Private Sub OB1_Click()
> Workbooks.Open Filename:="C:\Data\Rpt1.xls"
> UF1.Hide
> End Sub
>
> Thank you,

--~--~---------~--~----~------------~-------~--~----~
----------------------------------------------------------------------------------
Some important links for excel users:
1. Excel and VBA Tutorials(Video and Text), Free add-ins downloads at 
http://www.excelitems.com
2. Excel tutorials at http://www.excel-macros.blogspot.com
3. Learn VBA Macros at http://www.vbamacros.blogspot.com
4. Excel Tips and Tricks at http://exceldailytip.blogspot.com
 

To post to this group, send email to excel-macros@googlegroups.com
If you find any spam message in the group, please send an email to:
Ayush Jain  @ jainayus...@gmail.com or
Ashish Jain @ 26may.1...@gmail.com
<><><><><><><><><><><><><><><><><><><><><><>
HELP US GROW !!

We reach over 6,500 subscribers worldwide and receive many nice notes about the 
learning and support from the group. Our goal is to have 10,000 subscribers by 
the end of 2009. Let friends and co-workers know they can subscribe to group at 
http://groups.google.com/group/excel-macros/subscribe
-~----------~----~----~----~------~----~------~--~---

Reply via email to