View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default Button assign macro breaks with file name change and appears elsew

Your life will become much simpler if you include code to create the toolbar
when the workbook is opened and include code to destroy the toolbar when the
workbook is closed.

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)

Student wrote:

I have a series of buttons in a toolbar assigned to macros. I wish the
buttons to appear only in the workbook in which I created them and any copies
AND I wish the buttons to always execute the assigned macro copy in the open
workbook even though the file has been renamed.
Instead, the button seems to execute the macro in the filename last used to
assign the macro to the button.
I'm using a primitive configuration control of my workbook by appending the
date and version number to the file name. This requires that I reassign the
macros to all buttons with each minor revision. Worse, my clients must do
the same every time they copy from the server to their local workstation.
Even worse, the toolbar tends to show up on unrelated workbooks executed on
the same machine.
I need an understanding of the scope of these things and how to restrict it
to an open workbook.


--

Dave Peterson