Macros in Word 2003
Edit the macro code
If you open a macro in the Visual Basic Editor you can do all the following:
- Make corrections
- Remove unnecessary steps
- Rename or copy individual macros
- Add instructions that you cannot record in
Word.
Watch the following video to see a demonstration of how to view and edit macro code:
Which of the following statements are true? (Select all that are true.)
The name of the macro is shown after the word End Sub.
| |
The executing code for the macro is written between the lines Sub and End Sub.
| |
Any text which is preceded by an apostrophe is executable code.
| |
You should only add new code between the lines Sub and End Sub.
| |
To display Visual Basic Help:
|
Press F1.
| |
|
Place the cursor in the middle of a word and press F1.
| |
|
Click the Microsoft Word icon on the standard toolbar.
|
A message box is:
|
A box where the user types information.
| |
|
A box where you can create a variable name.
| |
|
A box that gives information to the user.
|
To create a message box:
|
Type InputBox followed by the message in brackets.
| |
|
Type MsgBox followed by the message in inverted commas.
| |
|
Type vbExclamation
|
- From the Macros dialog box select the Name macro.
- Click the Edit button to view the macro code.
- Change the font name.
- Change the size of the font.
- Change the colour of the font.
- Run the macro again.
- From the Macros dialog box select the Name macro.
- Click the Edit button to view the macro code.
- Create
a blank line before the End Sub line in the code and type MsgBox
“Great Name”, vbExclamation
- Return to Word by clicking on the Word icon on the Standard toolbar.
- Run the macro again.
Use the menu on the left to navigate your way to the next page.
