PC Review


Reply
Thread Tools Rate Thread

Buttons and macros

 
 
DevalilaJohn
Guest
Posts: n/a
 
      30th Apr 2008
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
 
Reply With Quote
 
 
 
 
Dave Peterson
Guest
Posts: n/a
 
      30th Apr 2008
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
 
Reply With Quote
 
DevalilaJohn
Guest
Posts: n/a
 
      1st May 2008
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
>

 
Reply With Quote
 
Dave Peterson
Guest
Posts: n/a
 
      1st May 2008
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 With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
more help on using buttons and Macros? Matt Microsoft Excel Misc 4 28th May 2009 11:06 PM
Buttons for Macros Ainsley Microsoft Excel Discussion 2 9th Mar 2006 11:43 AM
Buttons and macros? Joe Microsoft Excel Misc 3 7th Oct 2005 02:34 AM
Buttons for macros? Jim Microsoft Excel Worksheet Functions 1 16th Jun 2004 03:51 AM
Buttons and Macros Paul Microsoft Access Forms 2 21st May 2004 01:43 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:48 PM.