Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default macro confusion

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


  #2   Report Post  
Posted to microsoft.public.excel.programming
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
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default macro confusion

So, when I assign a macro to a button, it actually remembers the path to the
workbook where the macro is located?
And if I move the workbook to another location, it still tries to find the
macro at the original location?
Is there no way to specify that the macro should always be run from the
current workbook?

I appreciate your suggestion about using the control toolbox - however, I
think I read that there can be a problem because the control toolbox buttons
retain focus, unlike the forms toolbox buttons. Have you encountered this?

Thanks for your help!
Bill


"Dave Peterson" wrote in message
...
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



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default macro confusion

You could reassign the macro to the button each time you open the workbook and
remove any doubt how you think things should work.

And there was a problem with xl97 (changing the .takefocusonclick property to
false removed the problem).

BillE wrote:

So, when I assign a macro to a button, it actually remembers the path to the
workbook where the macro is located?
And if I move the workbook to another location, it still tries to find the
macro at the original location?
Is there no way to specify that the macro should always be run from the
current workbook?

I appreciate your suggestion about using the control toolbox - however, I
think I read that there can be a problem because the control toolbox buttons
retain focus, unlike the forms toolbox buttons. Have you encountered this?

Thanks for your help!
Bill

"Dave Peterson" wrote in message
...
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


--

Dave Peterson
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
macro confusion scott Excel Worksheet Functions 4 August 21st 08 04:30 PM
MDI Confusion CMoya Excel Discussion (Misc queries) 1 February 21st 08 02:11 PM
Confusion..... Eric @ CMN, Evansville Excel Discussion (Misc queries) 2 December 27th 05 07:15 PM
Macro confusion Yodaman Excel Programming 1 November 22nd 05 12:42 PM
Assign Macro 2 a Button....confusion Stuart[_21_] Excel Programming 11 October 14th 05 05:35 AM


All times are GMT +1. The time now is 12:41 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"