PDA

View Full Version : Solved: Userform Show/Hide Problem



pcsparky
11-02-2009, 09:25 AM
In wb1 I have a userform - Navigation

I have code in wb1 to open a known file say Book2.xlsm

I am able to hide Navigation form so that Book2 is activated but want the form to appear again if the user wishes to keep Book2 open.

To achieve this I have used:
Private Sub Workbook_WindowActivate(ByVal Wn As Window)
Navigation.Show
End Sub

However, if the user wishes to go back to Book2 they cannot because the Navigation form is still running. Is there a way of doing this without getting Navigation form to close Book2?

lucas
11-02-2009, 09:47 AM
Is your userform modal or modeless?

UserForm.show vbModeless

pcsparky
11-02-2009, 11:47 AM
Yes of course that was the answer I needed. I changed it to modal but this still caused a problem in that the form was visible when selecting the other wb.

Sorted it out by using Navigation.Hide in Workbook_Deactivate

Thank you