Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Buttons and macros

I have a spreadsheet template MyTemplate.xlt. It has a couple of custom
buttons in it that are tied to macros. I have the macros assigned to the
buttons as MyTemplate.xlt!MyMacro looking only at macros in MyTemplate.xlt.

When I open a spreadsheet using the template (File| New...) the spreadsheet
opens and sometimes the buttons work correctly. If I close Excel (2003) and
reopen the buttons generate an error message that the macro
....MyTemplate1.xlt!MyMacro cannot be found. When I go back to the template,
the macro assignment has been changed and matches what the message indicated.

I've tried this on a couple of computers and gotten the same result. How
does the macro assignment get changed in the template to match a spreadsheet
copy generated from it? I'd appreciate any suggestions.

TIA,

John
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Buttons and macros

You could reassign each macro to the correct button each time the workbook
opened...

But you may find it easier to use the commandbuttons from the Control Toolbox
toolbar instead of the buttons from the Forms toolbar.

Instead of assigning macros, you can just click on the commandbutton and see
where the code goes. (It's under the worksheet module--not in a general
module. So you may have to make changes to your code, too.)

DevalilaJohn wrote:

I have a spreadsheet template MyTemplate.xlt. It has a couple of custom
buttons in it that are tied to macros. I have the macros assigned to the
buttons as MyTemplate.xlt!MyMacro looking only at macros in MyTemplate.xlt.

When I open a spreadsheet using the template (File| New...) the spreadsheet
opens and sometimes the buttons work correctly. If I close Excel (2003) and
reopen the buttons generate an error message that the macro
...MyTemplate1.xlt!MyMacro cannot be found. When I go back to the template,
the macro assignment has been changed and matches what the message indicated.

I've tried this on a couple of computers and gotten the same result. How
does the macro assignment get changed in the template to match a spreadsheet
copy generated from it? I'd appreciate any suggestions.

TIA,

John


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Buttons and macros

Dave,

Thanks for the suggestion, that is a good workaround. I'm still curious as
to why the toolbar buttons change the source of their macro.

"Dave Peterson" wrote:

You could reassign each macro to the correct button each time the workbook
opened...

But you may find it easier to use the commandbuttons from the Control Toolbox
toolbar instead of the buttons from the Forms toolbar.

Instead of assigning macros, you can just click on the commandbutton and see
where the code goes. (It's under the worksheet module--not in a general
module. So you may have to make changes to your code, too.)

DevalilaJohn wrote:

I have a spreadsheet template MyTemplate.xlt. It has a couple of custom
buttons in it that are tied to macros. I have the macros assigned to the
buttons as MyTemplate.xlt!MyMacro looking only at macros in MyTemplate.xlt.

When I open a spreadsheet using the template (File| New...) the spreadsheet
opens and sometimes the buttons work correctly. If I close Excel (2003) and
reopen the buttons generate an error message that the macro
...MyTemplate1.xlt!MyMacro cannot be found. When I go back to the template,
the macro assignment has been changed and matches what the message indicated.

I've tried this on a couple of computers and gotten the same result. How
does the macro assignment get changed in the template to match a spreadsheet
copy generated from it? I'd appreciate any suggestions.

TIA,

John


--

Dave Peterson

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

The bad news is that it doesn't change the location of the macro. It still
wants to go off and find the macro in your .xlt workbook. And that's usually a
bad idea--lots of times, the template isn't shared with the recipients, so it
can't be found.

DevalilaJohn wrote:

Dave,

Thanks for the suggestion, that is a good workaround. I'm still curious as
to why the toolbar buttons change the source of their macro.

"Dave Peterson" wrote:

You could reassign each macro to the correct button each time the workbook
opened...

But you may find it easier to use the commandbuttons from the Control Toolbox
toolbar instead of the buttons from the Forms toolbar.

Instead of assigning macros, you can just click on the commandbutton and see
where the code goes. (It's under the worksheet module--not in a general
module. So you may have to make changes to your code, too.)

DevalilaJohn wrote:

I have a spreadsheet template MyTemplate.xlt. It has a couple of custom
buttons in it that are tied to macros. I have the macros assigned to the
buttons as MyTemplate.xlt!MyMacro looking only at macros in MyTemplate.xlt.

When I open a spreadsheet using the template (File| New...) the spreadsheet
opens and sometimes the buttons work correctly. If I close Excel (2003) and
reopen the buttons generate an error message that the macro
...MyTemplate1.xlt!MyMacro cannot be found. When I go back to the template,
the macro assignment has been changed and matches what the message indicated.

I've tried this on a couple of computers and gotten the same result. How
does the macro assignment get changed in the template to match a spreadsheet
copy generated from it? I'd appreciate any suggestions.

TIA,

John


--

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
Macros and buttons Sandy Excel Worksheet Functions 6 April 23rd 07 01:15 PM
Buttons and macros Richardisa1 New Users to Excel 3 March 23rd 07 09:25 PM
Macros AND Buttons [email protected] Excel Worksheet Functions 3 August 9th 06 09:03 AM
Macros And Buttons [email protected] Excel Discussion (Misc queries) 4 August 8th 06 10:37 PM
Buttons and macros? Joe Excel Discussion (Misc queries) 3 October 7th 05 02:34 AM


All times are GMT +1. The time now is 10:59 PM.

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

About Us

"It's about Microsoft Excel"