Error document already opened

  • Thread starter Thread starter jeffP
  • Start date Start date
J

jeffP

Hi all,
I have a ss with a few macros. I run them from tools>macros and from a
custom added menu bar item without problem. I also have a custom toolbar
with 5 buttons/ macros attached. When I try to run the macros from there I'm
getting an error message " A document with the name "Budget2005" is already
open. You cannot open two documents with the same name even if the documents
are in different folders, .........."blah,blah,blah.
I don't have two folders open, these macros used to work from this toolbar
and I'm stumped.
Any help , as always, would be greatly appreciated.
 
for each ctl in Commandbars("Custom1")
msgbox ctl.OnAction
Next

would show you what macro is assigned to each. Make sure they point to the
correct workbook.
 
Tom,
You were correct about checking where they pointed to. I used SaveAs to
back up the file in a different directory and somehow the macros assigned to
the cusstombar picked up the full path. I'm not sure how but anyway it's
fixed.
I tried to use your help w/ the for statement but get Run-time error 5
'invalid procedure or call' . I really don't understand the loop (where to
put it,etc) and would appreciate it if you could help me understand how to
use it and/or link me to somewhere that could teach me.
Thanks for all you help, always.
 
had a typo in it

Sub ShowOnAction()

For Each ctl In CommandBars("Matrix").Controls
On Error Resume Next
MsgBox ctl.Caption & " - " & ctl.OnAction
On Error GoTo 0
Next
End Sub

Change Matrix to the name of your commandbar

--
Regards,
Tom Ogilvy
 

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