How to create macro buttons in Excel and Word

Mar 11, 2002 | Beth Blakely | E-Mail
 


Last week, I told you how to create a macro to insert custom headers and footers in your Excel documents. Now I'll show you how to make that macro, and any others you might create, even easier to use. You can create a custom button for your toolbar that will activate a macro in both Microsoft Excel and Microsoft Word.

Create a macro button in Microsoft Excel
The following directions were written using Microsoft Excel 2000. Instructions for other versions may differ slightly.

  1. Open a new workbook.
  2. From the Tools menu, choose Customize, as shown in Figure A.

 

Figure A

 

  1. Click the Commands tab and then scroll down the left-hand Categories column and select Macros (see Figure B).
  2. You’ll see Custom Button in the Commands box. Click, hold, and drag the custom button onto any toolbar and release, as shown in Figure B.

 

Figure B

 

  1. Right-click the new button and choose Assign Macro.
  2. Choose HeaderFooter and click OK. You may now change the button icon by right-clicking the button, choosing Change Button Image, and clicking on another icon, as shown in Figure C.

 

Figure C

 

  1. Close the Customize dialog box.


You may now run your macro by clicking the button you've created. It will be available from all workbooks.

Create a macro button in Microsoft Word
Creating a macro button in Microsoft Word is similar to creating one in Excel. The following directions were written using Microsoft Word 2000. Instructions for other versions may differ slightly. Before starting the steps below, I created a macro, named PasteText, to paste unformatted text in Word documents. To create a macro button:

  1. Open a new document.
  2. From the Tools menu, choose Customize.
  3. Click the Commands tab and then scroll down in the Categories box and select Macros (see Figure D). You’ll see the names of any macros you've created in the Commands box on the right-hand side.
  4. Click, hold, and drag your macro onto any toolbar and release, as shown in Figure D. A button with the name of the macro will appear on the toolbar.

 

Figure D

 

  1. To associate an icon with this button, right-click it, choose Change Button Image, and click on any icon (see Figure E).

 

Figure E

 

  1. Next, right-click the button and choose Default Style. Your button will now appear as an icon only.


You may run your macro by clicking the button you've created. It will be available from all documents.

Created Date: 03/14/2002  Last Reviewed: 03/14/2002  Rev. Date: