custom menus in excel

S

siansun

I have created an excel application with mostly custom menus using vba code.
The problem is that when the application is open, if i try to open a regular
excel file it also opens showing only the custom menus. is there a way to
(programmatically) get around this problem? and would i be able to do this in
vba code for the application containing the custom menus?

thanks
 
C

Chip Pearson

In the application workbook, you can use the Activate and Deactivate
events in the ThisWorkbook code module to make the menus hidden when
your workbook is deactivated (user switches to another workbook) and
then restore their visibility when the workbook is activated (user
returns to your workbook).

' In the ThisWorkbook code module:
Private Sub Workbook_Activate()
' code to make menus/commandbars visible
End Sub

Private Sub Workbook_Deactivate()
' code to make menus/commandbars hidden
End Sub


Cordially,
Chip Pearson
Microsoft Most Valuable Professional
Excel Product Group, 1998 - 2009
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)
 
O

Otto Moehrbach

Use a Workbook_Activate macro to create the custom menus, and a
Workbook_Deactivate macro to remove the custom menus. That way the custom
menus appear only if that workbook is the active workbook. HTH Otto
 
S

siansun

Great! Thanks for the help.

Chip Pearson said:
In the application workbook, you can use the Activate and Deactivate
events in the ThisWorkbook code module to make the menus hidden when
your workbook is deactivated (user switches to another workbook) and
then restore their visibility when the workbook is activated (user
returns to your workbook).

' In the ThisWorkbook code module:
Private Sub Workbook_Activate()
' code to make menus/commandbars visible
End Sub

Private Sub Workbook_Deactivate()
' code to make menus/commandbars hidden
End Sub


Cordially,
Chip Pearson
Microsoft Most Valuable Professional
Excel Product Group, 1998 - 2009
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top