Frontpage 2000 VBA - making a macro into a hot key and an icon 

FrontPage 2000 supports Visual Basic for Applications. This means you can write powerful macros that automate your web page editing. 

Importing a VBA  macro from a .bas file

Say I've written a FrontPage VBA macro that inserts various bits of HTML into my page -- e.g. to give me a page number, in red and superscript. You can import my macro by selecting "Tools" from the FrontPage 2000 menu. Select the "Macro" menu option and then select "Visual Basic Editor". 

Once you are in the Visual Basic Editor, select the "File" menu. Select the "Import File" menu option and then browse to the act.bas VBA module on your hard drive. 

Running the VBA macro

You can run the macro by selecting the "Tools" menu, "Macros" menu option, highlight the insertPageNo procedure, and click the RUN button.

Run the VBA macro from a toolbar button

Running the macro using the Macros menu is cumbersome if you need to do the command every few seconds.

If you would like to associate a toolbar button with this macro, right click on an empty area of the toolbar. In the screen-shot below, I right-clicked on the area to the right of the 'Help' menu.  This brings up a menu.  

Now select the "Customize..." menu option. You get the following menu.  Click the "Commands" dialog box tab and scroll down the categories to find "Macros" which you'll then select. 

Drag the "Custom Button" (smiley face) to the toolbar. The smiley face will then appear as a new button on the toolbar.  

Right click on the new smiley face icon on the toolbar.  A menu will appear:

Now select the "Assign macro..." menu option. This brings up the same list of macros given earlier: choose one and press OK.  Clicking on that smiley face will now run that macro.

You can also change the icon for your custom button.  Right click again on the smiley-face to get the menu.  Then choose 'Change Button Image>':

If you want to run the macro as a keyboard shortcut, right-click on the smiley face again.  This time change the 'Name:' field to &1mymacro.  Also change the style to 'Image and Text', so that the macro name appears on the toolbar.  This will then display 1mymacro, and thus Alt-1 will run your macro, just as Alt-H opens the Help menu and Alt-r opens the Frames menu.  I always use numbers, because they do not conflict with any existing shortcut: and if by chance your choice does conflict, your short-cut won't work.

Constructive feedback is welcomed to Roger Pearse.  This page is derived from one originally written by Robert Robbins, which has since vanished from the web, "Robert Robbins - FrontPage VBA".  The page still exists at www.archive.org but without the essential screen-shots or the zip file of the VBA code.

Written 2nd January 2006.

This page has been accessed by  ****** people since 2nd January 2006.

Return to Roger Pearse's Pages