View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
jeffP jeffP is offline
external usenet poster
 
Posts: 38
Default repost: error 'document already opened'

Trying to run a macro from a custom toolbar I get the error
"A document with the name "myworkbook" is already open. You cannot open two
documents .....blah,blah,blah.
This error is happening w/ my custom toolbar. I have a few macros that run
from ToolMacro ,a custom menu bar item and a custom toolbar just fine.
But, if I save the workbook w/ SaveAs to another directory (same filename)
for backup I cause a problem. When I re-open the original workbook and try
to run macros from the custom toolbar I get the above error. It's because
the path has been changed and points to the directory where the backup was
put. This doesn't affect the macro, nor running the macros from the menu bar
.. Just the custom toolbar. I have the following code for opening the toolbar
w/ Workbook_Open event

With Application
.CommandBars("BudgetBar").Visible = True
additional code
end with

and this with Workbook_BeforeClose
Application.CommandBars("BudgetBar").Visible = False

I'm thinking it's because the object is Application and should be something
smaller (workbook?) but I"m obviously confused and any and all help is
always appreciated.
--
jeff