UserForm To UserForm 
Author Message
 UserForm To UserForm

I have 2 workbooks with userforms in them.  (WorkBook1 has UsrForm1
and WorkBook2 contains UsrForm2)  UsrForm1 has a command button that
will hide itself when clicked and open workbook2, which will auto-open
with UsrForm2.  What I need to know how to do is when a command button
is UsrForm2 is clicked. it makes UsrForm1 in the WorkBook1(which is
alredy open) re appear.  Any suggestions would be great.  Thanks,
Corey


Sun, 04 Sep 2005 03:17:55 GMT  
 UserForm To UserForm
Corey,

You need to use the Application.run command.

In Master.xls you would have the following code in a module

Sub Show()
frmMaster.Show
End Sub

and the following in your form, which I have called frmMaster

Private Sub CommandButton1_Click()
Me.Hide
Workbooks.Open ("e:\my documents\my excel files\temp\LoadBook.xls") ' the
second book you want to load
ActiveWorkbook.RunAutoMacros xlAutoOpen
End Sub

In LoadBook.xls you would have this in a module

Sub Auto_open()
frmLoaded.Show 'your second form
End Sub

and the form would have the following code

Private Sub CommandButton1_Click()
Me.Hide
'OR unload me
Application.Run ("Master.xls!ReShow")
End Sub

Note that this will not work a second time because you have already opened
the LoadBook - you could save and close it when you click the button on the
userform.

Robin Hammond.


Quote:
> I have 2 workbooks with userforms in them.  (WorkBook1 has UsrForm1
> and WorkBook2 contains UsrForm2)  UsrForm1 has a command button that
> will hide itself when clicked and open workbook2, which will auto-open
> with UsrForm2.  What I need to know how to do is when a command button
> is UsrForm2 is clicked. it makes UsrForm1 in the WorkBook1(which is
> alredy open) re appear.  Any suggestions would be great.  Thanks,
> Corey



Sun, 04 Sep 2005 03:52:26 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Variable(s) Reset by Showing 2nd UserForm on top 1st UserForm

2. Displaying Another UserForm when click on CheckBox in UserForm

3. Passing a Variable from one Userform to another Userform

4. Userform Properties not available in MSForms.Userform

5. VBProject / VBComponent [DYNAMIC Userform called from a STATIC Userform]

6. UserForm or not to UserForm?

7. UserForm events and moving a UserForm

8. Opening userforms from other userforms

9. Using mouse-click outside userform to close userform

10. VBProject/VBComponent [DYNAMIC Userform called from a STATIC Userform]


 
Powered by phpBB® Forum Software © phpBB Group