Developer

FrontPage 2000 Magic: Four tips to help you customize FrontPage

Customize FrontPage by making a macro, creating your own commands, and more.

By Scott R. Garrigus
6/15/99

1. Customize your menus and toolbars
Initially, FrontPage's short menus only display the standard commands, and, as you work, the program automatically adds the commands you use most often. If you don't like this automatic customization, you can turn it off by selecting Tools/Customize, clicking the Options tab, and deselecting Menus Show Recently Used Commands First.

You also can choose how to customize the menus and toolbars. Click the Commands tab of the Customize dialog box to display all the commands available within FrontPage. Drag and drop commands from the Customize dialog box onto the menu or toolbar of your choice. To create a new toolbar, choose Tools/Customize, click the Toolbars tab, and click the New button. Type a name for your new toolbar and then simply drag and drop whatever commands you want on to your new toolbar from the Commands tab.

2. Make a macro button
One of the best new features of FrontPage 2000 is the Visual Basic for Applications Macro Editor. Macros can be a great help in applying a number of repetitive tasks. The only problem is that after you create a macro you have to go through a series of menus just to access it, which defeats the purpose of the shortcut. Expanding a bit on the previous tip, FrontPage will let you create your own custom macro button.

Select Tools/Customize and click the Commands tab. Click the Macros category and then drag and drop either the Custom Menu Item command to a menu or the Custom Button command to a toolbar. Right-click the command. On the pop-up menu type in a new name for the command, then select Assign Macro. Choose a macro from the Macro dialog box, and you've got your new macro button. You also can change the icon for the button by right-clicking it and selecting either Change Button Image or Edit Button Image. Change Button Image displays a selection of 48 premade icons from which you can choose. If you don't like any of those, the Edit Button Image function will let you actually create one of your own.

3. Create your own commands
FrontPage 2000 now includes support for the Visual Basic for Applications (VBA) language, which has become so popular because of its widespread use in Microsoft Office. With VBA, you can automate tasks, manipulate different aspects of your Web project within the VBA programming environment, and create your own commands. As an example, here's how to add a Save All command to FrontPage that will allow you to save every open page in a project with just one click.

First, start the Visual Basic Editor (VBE) by selecting the Tools/Macro/Visual Basic Editor menu. Insert a new module by selecting the Insert/Module menu. In the Properties window (located on the left side of the VBE window), change the name of the module to SaveAll. Now, in the module code window that opened up when you inserted a new module, type this code:



Sub Save_All() 'Name of the macro
'Checks that the document is in Page view in FrontPage and that at least one page is open.
  If (Application.ActiveWebWindow.ViewMode = fpWebViewPage _
      And ActiveWebWindow.PageWindows.Count > 0) Then
      Dim activePage, page As PageWindow 'Declare variables
'Set the variable ActivePage to the current active page
      Set activePage = ActivePageWindow
'Loop through all open pages
      For Each page In ActiveWebWindow.PageWindows
          page.Activate
'Click the Save button for each page
          CommandBars("Add Command").Controls("&File"). _
            Controls("&Save").Execute
Next
'Display the page you were working on when the Save All command was clicked
      activePage.Activate
  End If
End Sub

To add the new command to the File menu in FrontPage, choose Tools/Customize to open the Customize dialog box. Under the Command tab, select Macros from the Categories list. Drag the Custom Menu Item item from the Commands list onto the FrontPage File menu and drop it beneath the Save command. Next, click the Modify Selection button in the Customize dialog box, and a context menu will appear. Type Save All in the Name field and then select Assign Macro. In the Macro dialog box, select the Save_All macro and click OK. Close the Customize dialog box, and your new Save All command appears in the FrontPage File menu.

4. Teach FrontPage to format your code
You can tell FrontPage how you like your code, and it will format it automatically. By providing a sample file, you can specify if you'd like your code indented, your tags capitalized, and so on. Open a sample page that contains code formatted the way you prefer (the more tags in your sample page, the better). Then select Tools/Page Options and click the HTML Source tab. Click the Base On Current Page button, and FrontPage will set its formatting rules accordingly. Then select the Reformat Using The Rules Below option, and every page you load and save will be formatted like the sample file.

(Note: Special thanks to Tricia Fahey, Gretchen Tosh, and the FrontPage Development Team for all of their expertise.)

Scott R. Garrigus is an author, musician, and all-around, multimedia guru. In addition to his frequent contributions to CNET Builder.com, he publishes his own e-zine called Comp-media.

Editor's Picks