Master Workbook/Form

G

glen.e.mettler

I have a workbook that contains a user form with 4 command buttons
(named IMSTOOLS).
Each button is connected to a different workbook.
When a command button is selected, I hide IMSTOOLS and open the
selected workbook.
All that works just fine.
When I close the selected workbook, I want to return to IMSTOOLS.

I get an error message when I insert IMSTOOLS.show into the BeforeClose
event of the selected workbook.

How can I get back to and show the original user form - IMSTOOLS?

Glen
 
U

uf_gator

I suspect that the error is because the IMSTOOLS userform is not
located in the workbook where you are running the BeforeClose event.

I am pretty sure that when you are running macros in workbook A you can
only access userforms or modules within workbook A.

You could use the BeforeClose event to activate the workbook containing
the userform and then use some Activate event in that workbook to show
the userform (e.g., whenever the workbook is activated, show the
userform, whenever it is deactivated, hide the userform).

Alternatively, you could use a custom tool bar instead of the userform.
The buttons can be linked to a macro to open the files you need to
open (look for commandbar in the VB Help).
 
W

windsurferLA

I'm not familiar with the "BeforeClose" feature...

but consider adding a auto_close macro to put things in order.

Sub auto_close()
..........
End Sub

WindsurferLA
 
W

windsurferLA

I'm not familiar with the "BeforeClose" feature...

but consider adding a auto_close macro to put things in order.

Sub auto_close()
..........
End Sub

WindsurferLA
 
W

windsurferLA

I'm not familiar with the "BeforeClose" feature...

but consider adding a auto_close macro to put things in order.

Sub auto_close()
..........
End Sub

WindsurferLA
 
Top