Thread: macro confusion
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default macro confusion

You could reassign the macros to the new workbook.

But it may be easier to replace the buttons from the Forms toolbar with
commandbuttons from the control toolbox toolbar.

The code would move from a General module into the worksheet (doubleclick on the
button while in design mode and you'll see the click event).

And you may have to modify your code a bit.

This is one of the good things about using the Commandbuttons from the control
toolbox toolbar--there's no macro assignments to get messed up.

BillE wrote:

I have buttons on my spreadsheet that run macros no problem.

I copied the spreadsheet to a different location on the same computer, and
now when I click a button in the copy to run a macro, i get the error:
"A document with the name messed_up.xls is already open. You cannot open
two documents with the same name etc."

But NO other spreadsheet is open.

I can fix this by relinking the button to the macro in the copy it is
supposed to run and it works fine again.

However, I don't understand what is happening. Are the buttons pointing to
macros in the spreadsheet in the original location instead of the copy?
When the macros run, are they trying to open the original spreadsheet and
hence the error?

On this hypothesis, I changed the name of the copy to messed_upMore.xls.
Now when I click the button to run the macro in messed_upMore.xls, I get the
error
"messed_up.xls could not be found. Check the spelling of the file name etc."

I hope somebody can explain this or refer me to a resource which will
explain it. I have searched google but only found the clue about relinking
the macros, with no explanation.

Thanks
Bill


--

Dave Peterson