Load custom buttons in a Spreadsheet

G

Garrystone

Hi
I know how to create a custom button and attach a macro to that button
and that I can automatically load a button 'Private Sub
Workbook_Activate()' (Alt F11). Which I need to do because this
spreadsheet is used by many of my students (different profiles) and I
only want it available in a single spreadsheet file that they will
access. My problem lies in that each time I load this Spreadsheet a new
button is placed on the toolbar (i.e. load 3 times, I end up with 3 new
buttons) and I can't seem to get the button to link to the macro
without it running the command and not waiting until the button is
pressed.
Can anybody help please as it is causing me much distress.

Thank you

Garry
 
G

Gord Dibben

You must code to create the button when workbook opens, then delete the
button when it closes.

See Debra Dalgleish's site for creating a Toolbar with your button and
assign a macro to that button.

http://www.contextures.on.ca/xlToolbar02.html#Code

Note: the instructions found are for creating an add-in.

Just modify those instructions to place the code into a general module in
the workbook the students are to use.


Gord Dibben MS Excel MVP
 
G

Garrystone

Thanks for your advice (which of course worked) with a small tweak (I
needed to dock the toolbar:top and not float).

Thanks again

Garry
 
G

Gord Dibben

Good to hear.

Thanks for the feedback

Thanks for your advice (which of course worked) with a small tweak (I
needed to dock the toolbar:top and not float).

Thanks again

Garry
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top