SECTION 1
Lesson 1.3: Macros

   

 

 

Let’s take a look at what happens when you select a macro and click Edit. First, the macro will open in Microsoft Visual Basic Editor:

 

 

Visual Basic Editor is a very powerful program capable of a lot of tasks. We’re not going to delve into it in depth, though, as there are entire books written on this program alone, but let’s take a look at each of its menus to get an idea of what you can do.

 

File

Save, export, print, or delete this macro, or import a new macro.

Edit

Contains basic editing commands such as cut, copy, paste, find, replace, undo, redo, and indent and outdent. You can also view properties, values that remain constant (called constants), quick info, and parameter info. Bookmarking tools (which are used in queries) are also in this menu.

View

Allows you to change your view and open toolbars.

Insert

Add other elements to your project, such as forms, files, procedures, and modules.

Format

Change the alignment, grouping, size, spacing, and order of items with this menu.

Debug

Compile your project, run certain parts of the script, watch for a part of script, toggle or clear breakpoints, and set statements.

Run

Run the macro, reset the macro, add a break, or enter design mode.

Tools

Add references, additional controls, or a digital signature. You can also enter the main macro dialog box, edit project properties, or set Visual Basic Editor options.

Add-ins

Manage add-ins using this menu.

Window

Split, tile, cascade, arrange, or toggle between open Visual Basic Editor windows.

Help

Contains Visual Basic Editor help.

 

 

In the main part of the Visual Basic Editor screen, each line of your macro is broken down in a list of code. You can see that the sample macro contains text that was then formatted as Verdana 20, Bold and aligned to the centre. Then, a picture was added. After that, recording was stopped.

 

 

As each line is shown here, this is a good way to see exactly what a macro will do before you run it.

 

Once you’re done making your changes, click the File menu and click Close and Return to Microsoft Word. Your changes will automatically be saved.