ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Custom Menu Issue. (https://www.excelbanter.com/excel-discussion-misc-queries/157336-custom-menu-issue.html)

Ayo

Custom Menu Issue.
 
I created a custom mene that I assigned a macro to. But it keeps showing up
in other files.
How do I get it to show only in the workbook it was created for and not in
every other workbook.

Kevin B

Custom Menu Issue.
 
In the workbook module, apply the following to the Activate/Deactivate
Open/Before close workbook triggers:
*************************************************
Private Sub Workbook_Activate()

Workbook_Open

End Sub

Private Sub Workbook_BeforeClose(Cancel As Boolean)

Application.CommandBars("Your_Menu_Name_Here").Vis ible = False

End Sub

Private Sub Workbook_Deactivate()

Workbook_BeforeClose True

End Sub

Private Sub Workbook_Open()

Application.CommandBars("Your_Menu_Name_Here").Vis ible = True

End Sub

*************************************************
--
Kevin Backmann


"Ayo" wrote:

I created a custom mene that I assigned a macro to. But it keeps showing up
in other files.
How do I get it to show only in the workbook it was created for and not in
every other workbook.


Ayo

Custom Menu Issue.
 
I keep getting the "Invalid procedure call or argument" error on:
Application.CommandBars("Generate Report").Visible = True and
Application.CommandBars("Generate Report").Visible = False

What am I doing wrong?

"Kevin B" wrote:

In the workbook module, apply the following to the Activate/Deactivate
Open/Before close workbook triggers:
*************************************************
Private Sub Workbook_Activate()

Workbook_Open

End Sub

Private Sub Workbook_BeforeClose(Cancel As Boolean)

Application.CommandBars("Your_Menu_Name_Here").Vis ible = False

End Sub

Private Sub Workbook_Deactivate()

Workbook_BeforeClose True

End Sub

Private Sub Workbook_Open()

Application.CommandBars("Your_Menu_Name_Here").Vis ible = True

End Sub

*************************************************
--
Kevin Backmann


"Ayo" wrote:

I created a custom mene that I assigned a macro to. But it keeps showing up
in other files.
How do I get it to show only in the workbook it was created for and not in
every other workbook.



All times are GMT +1. The time now is 01:26 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com