Bra Utbildning AB

 

<-- Back
VBA & Object models
Work with text
Bookmarks
Ranges
Fields
Form fields
Autotext
Doc var & Doc Prop
Built-in commands
Built-in dialogs
Automation
External databases

Work with built-in commands in Word


The application Word is built around many visible procedures (macros if you like). You can modify many of the built-in features and add your own customizations to fit the needs of your company/organization.

When you save or print a document a predefined command is executed. To modify one of the built-in commands is referred to as intercept

If you are using a non-English version of  Word you still have to use the English commands. You'll be presented with a list of commands in your language version of Word - not the English ones. You'll  have to guess or download a list to get the correct wording. The link at the end of the document will help you find the Excel file, which also includes information about every command and their shortcuts applicable to the English version of Word.

Follow these steps to intercept FileSaveAs

1. Select Tools-Macro-Macros

2. Type the macro name, for instance FileSaveAs. When typing the correct word, you'll see a description, in the text box at the bottom of the dialog. Even if you have a foreign version you type it in English. When you've typed an identifiable string Word will display what the macro does. If there are typos no text will show in the lower text box.

3. Select the Create button on screen.

4. A macro window (in the VB-editor) will open up with the modified command's code displayed. 

   Sub FileSaveAs()
   '
   ' FileSaveAs Macro
   ' Saves a copy of the document in a separate file
   '

      Dialogs(wdDialogFileSaveAs).Show

   End Sub

Make changes to the macro, save and close the editor. If it was a FileSaveAs macro you created, try to select File | SaveAs to see what happens.

More about this at the MVP site  Intercept Save and Print