Custom Menus in Chart Sheets

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi all,

I've an Excel workbook with sheets and charts. On the sheets I was able to
include a custom menu, which works fine. However, if I select a chart, the
custom menu disappears. I am aware of the fact that the reason for this
action is the "Worksheet Menu Bar" flag in my code and I need to include the
"Chart Menu Bar" flag.

I tried for quite some time and I couldn't figure out how I can write my
code that the programm knows if I am on a chart or a ordinary sheet and
display the menu.

Does anybody has an idea, how I could include the "Chart Menu Bar" flag into
my code below?

' Set a CommandBar variable to Worksheet menu bar
Set cbMainMenuBar = _
Application.CommandBars("Worksheet Menu Bar")

Thank you very much for your support.

Kind regards,

Simon Minder
 
Hi Simon,

Duplicate the custom menu you've put on "Worksheet Menu Bar" on the "Chart
Menu Bar". In other words your custom menu on both bars.

One way to avoid duplicate code might be something like this

For i = 1 to 2
sBar = iif(i = 1, "Worksheet Menu Bar", "Chart Menu Bar")
Set cmdBar = _
Application.CommandBars(sBar)
' custom menu code
Next

Assumes of course your menu goes in a "place" that exists on both bars.

Regards,
Peter T
 

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

Back
Top