Приглашаем посетить
Аверченко (averchenko.lit-info.ru)

Understanding How Macros Automate Your Work

Table of Contents Previous Next

Understanding How Macros Automate Your Work

To complete many tasks in FrontPage, you need to execute a series of commands and actions. If you often need to complete the same task, you'll find yourself repeatedly taking the same series of steps. It can be tiresome to continually repeat the same commands and actions when you can create a mini-program, or macro, that accomplishes all of them with a single command.

When you create a macro, FrontPage stores the list of commands with any name you choose. You can store your macros in Microsoft FrontPage or All Open Projects. Storing your macros in FrontPage makes the macros available to you from any location in FrontPage, even when no project is open.

Once a macro is created, you can make modifications to it, add comments so other users will understand its purpose, and test it to make sure it runs correctly. You can run a macro by choosing the Macro command on the Tools menu, or by using a shortcut key or clicking a toolbar button you've assigned to it. When you click the Tools menu, point to Macro, and then click Macros, the Macro dialog box opens. From this dialog box, you can run, edit, test, or delete any FrontPage macro on your system, or create a new one.

If you have problems with a macro, you can step through the macro one command at a time, known as debugging. Once you identify any errors in the macro, you can edit it.

graphics/14inf21.gif

You can create and edit a macro with the Microsoft Visual Basic Editor, which comes with FrontPage. Macro code is written in Microsoft Visual Basic, a programming language.

Each action listed in a macro either performs a step or states what attributes are turned on (true) or off (false). Quotation marks are used to indicate typed text, and the terms Sub and End Sub are used to indicate the beginning and ending of subroutines, respectively.

Because not everyone wants to read through codes to figure out what a macro does, comments are often included within the code. The comments don't affect the macro; they simply clarify its purpose or actions for a person viewing the code. Comments can be used to help you remember why you took the steps you did, or to help co-workers understand what is going on in the macro and how the macro should be used. A comment always begins with an apostrophe to distinguish it from a command code.

To learn more about macro code, check out Visual Basic titles on the Que Publishing Web site at www.quepublishing.com.

graphics/14inf22.gif

    Table of Contents Previous Next