PC Review


Reply
Thread Tools Rate Thread

Assigning Macro to Toolbar

 
 
=?Utf-8?B?RWRk?=
Guest
Posts: n/a
 
      4th May 2007
I have written several macros to use in a workbook document in excel 2003 and
want to associate them with buttons on a tool bar. I have successfully done
this but when i try to distribute the workbook to another user on a different
PC the tool bars are no longer associated with the macros in the workbook. I
have attached the tool bars to the workbook and even have a small routine to
remove the toolbars when the workbook is closed.

I am new to programming in excel and I am sure this is something simple and
obvious. Thanks for the assistance.
 
Reply With Quote
 
 
 
 
Bob Flanagan
Guest
Posts: n/a
 
      4th May 2007
Edd, each time you modify the toolbar, you should delete the one that is
attached and re-attach the toolbar. Also, I like to delete attached
toolbars when the workbook is closed. This insures that the next time it is
open that the attached bar appears. Lastly, you can write a macro that
resets the onaction property of each button when the workbook is opened.

Bob Flanagan
Macro Systems
http://www.add-ins.com
Productivity add-ins and downloadable books on VB macros for Excel

"Edd" <(E-Mail Removed)> wrote in message
news:3FE3D1BC-7518-47FA-AE73-(E-Mail Removed)...
>I have written several macros to use in a workbook document in excel 2003
>and
> want to associate them with buttons on a tool bar. I have successfully
> done
> this but when i try to distribute the workbook to another user on a
> different
> PC the tool bars are no longer associated with the macros in the workbook.
> I
> have attached the tool bars to the workbook and even have a small routine
> to
> remove the toolbars when the workbook is closed.
>
> I am new to programming in excel and I am sure this is something simple
> and
> obvious. Thanks for the assistance.



 
Reply With Quote
 
=?Utf-8?B?RWRk?=
Guest
Posts: n/a
 
      4th May 2007
I am deleting the old tool bar when I make changes. The problem I am having
is when I move the workbook to a different account or computer (different
excel install) the macro tool bar is no longer properly associated with the
macros and it must be removed and recreated manually. I am unfamiliar with
the onaction property but I will look into it. Perhaps this could be used to
reset the path to the macro in the button?

Edd

"Bob Flanagan" wrote:

> Edd, each time you modify the toolbar, you should delete the one that is
> attached and re-attach the toolbar. Also, I like to delete attached
> toolbars when the workbook is closed. This insures that the next time it is
> open that the attached bar appears. Lastly, you can write a macro that
> resets the onaction property of each button when the workbook is opened.
>
> Bob Flanagan
> Macro Systems
> http://www.add-ins.com
> Productivity add-ins and downloadable books on VB macros for Excel
>
> "Edd" <(E-Mail Removed)> wrote in message
> news:3FE3D1BC-7518-47FA-AE73-(E-Mail Removed)...
> >I have written several macros to use in a workbook document in excel 2003
> >and
> > want to associate them with buttons on a tool bar. I have successfully
> > done
> > this but when i try to distribute the workbook to another user on a
> > different
> > PC the tool bars are no longer associated with the macros in the workbook.
> > I
> > have attached the tool bars to the workbook and even have a small routine
> > to
> > remove the toolbars when the workbook is closed.
> >
> > I am new to programming in excel and I am sure this is something simple
> > and
> > obvious. Thanks for the assistance.

>
>
>

 
Reply With Quote
 
Dave Peterson
Guest
Posts: n/a
 
      4th May 2007
I find it much easier to build the toolbar when the workbook opens and delete it
when the workbook closes.

For additions to the worksheet menu bar, I really like the way John Walkenbach
does it in his menumaker workbook:
http://j-walk.com/ss/excel/tips/tip53.htm

Here's how I do it when I want a toolbar:
http://www.contextures.com/xlToolbar02.html
(from Debra Dalgleish's site)

But if you really want to continue creating the toolbar manually, you'll have to
delete the toolbar when the workbook closes (for all the users). Then the newly
attached toolbar will be used.

Jan Karel Pieterse has some notes:
http://www.jkp-ads.com/Articles/DistributeMacro04.htm

Note the addition of the code that deletes the toolbar in the
Workbook_BeforeClose event.

Edd wrote:
>
> I am deleting the old tool bar when I make changes. The problem I am having
> is when I move the workbook to a different account or computer (different
> excel install) the macro tool bar is no longer properly associated with the
> macros and it must be removed and recreated manually. I am unfamiliar with
> the onaction property but I will look into it. Perhaps this could be used to
> reset the path to the macro in the button?
>
> Edd
>
> "Bob Flanagan" wrote:
>
> > Edd, each time you modify the toolbar, you should delete the one that is
> > attached and re-attach the toolbar. Also, I like to delete attached
> > toolbars when the workbook is closed. This insures that the next time it is
> > open that the attached bar appears. Lastly, you can write a macro that
> > resets the onaction property of each button when the workbook is opened.
> >
> > Bob Flanagan
> > Macro Systems
> > http://www.add-ins.com
> > Productivity add-ins and downloadable books on VB macros for Excel
> >
> > "Edd" <(E-Mail Removed)> wrote in message
> > news:3FE3D1BC-7518-47FA-AE73-(E-Mail Removed)...
> > >I have written several macros to use in a workbook document in excel 2003
> > >and
> > > want to associate them with buttons on a tool bar. I have successfully
> > > done
> > > this but when i try to distribute the workbook to another user on a
> > > different
> > > PC the tool bars are no longer associated with the macros in the workbook.
> > > I
> > > have attached the tool bars to the workbook and even have a small routine
> > > to
> > > remove the toolbars when the workbook is closed.
> > >
> > > I am new to programming in excel and I am sure this is something simple
> > > and
> > > obvious. Thanks for the assistance.

> >
> >
> >


--

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
Assigning macro to toolbar Peter A Microsoft Word Document Management 2 5th Mar 2008 03:08 PM
Assigning macro to toolbar - only works sometimes! Zak Microsoft Excel Worksheet Functions 4 30th Jan 2008 04:47 PM
Assigning a macro to a button on a toolbar valerashylin Microsoft Excel Programming 2 20th Nov 2007 09:11 PM
assigning macro to toolbar button =?Utf-8?B?dGpi?= Microsoft Excel Worksheet Functions 2 19th Oct 2005 06:36 PM
Assigning a macro to a toolbar button...How? abxy Microsoft Excel Discussion 3 4th Feb 2004 05:36 PM


Features
 

Advertising
 

Newsgroups
 


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