Why does this mouse menu call a sub from another workbook?

  • Thread starter Thread starter Hermac
  • Start date Start date
H

Hermac

Hello,

I've been on this problem for more than a day now and I can't figure it
out.
I have a worksheet embedded chart which, on right click, shows a
modified mouse menu, which in turn allows to fire a sub called
"MaakGraf". Like this

Set MenuItem =
Application.CommandBars("Object/plot").Controls.Add(Type:=msoControlButton)
With MenuItem
.Caption = "Maak deze Grafiek"
.OnAction = "MaakGraf"
End With

It worked perfectly until yesterday. But since then, when clicking the
"Maak deze Grafiek" option, I get a prompt to enable or disable the
macro's of an OTHER workbook, to wich there is absolutely no link
although this other workbook is very similar to the active one and has
a sub with the same name. If enabled, the other workbook is opened.

If called with F5 or via the Extra-Macro menu, the sub perfectly refers
to the intended sub in the active workbook.

What am I overlooking here ?

Thank you very much for any help.
Herman
 
The button is still assigned to the MaakGraf in the other workbook.

I would delete either the "maak deze grafiek" item from the Object/plot
commandbar before building it or even delete the whole object/plot commandbar
before creating that one.
 

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