ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Assigning Macro to Toolbar (https://www.excelbanter.com/excel-programming/388716-assigning-macro-toolbar.html)

Edd[_2_]

Assigning Macro to Toolbar
 
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.

Bob Flanagan

Assigning Macro to Toolbar
 
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" wrote in message
...
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.




Edd[_2_]

Assigning Macro to Toolbar
 
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" wrote in message
...
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

Assigning Macro to Toolbar
 
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" wrote in message
...
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


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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com