Limiting a Button to a single workbook

M

Mark

I have created a macro in a workbook and assigned it to a
custom button that appears on my Macros toolbar.

This works great for what I want to do but I only need
the macro/button to show up in this one workbook.

Now, whenever I create a new workbook, the custom button
shows.

Is there any way I can limit it to just the workbook I
specify?

Thanks!
 
D

Dennis Schuessler

When you save your macro there is a box to tell it to
save in your personal workbook or save it in this
workbook only. Select this workbook only and then delete
it out of your personal workbook
 
M

Mark

Thanks for your reply. Yes, I did this. I saved the
macro in "This Workbook Only". But, I also have a button
that has that macro assigned. The button is what's
appearing in every new workbook I create. Even though I
specified the macro only for the one workbook - the
button runs the macro in anything I create.
 
D

Dave Peterson

You could do some fancy stuff hiding the button (or toolbar if it has its own
toolbar) using workbook events, but you may want to weasel out.

Add something like:

if activeworkbook.name <> thisworkbook.name then
msgbox "not for this workbook, buddy"
exit sub
end if

near the top.
 
Top