Purpose: he purpose of this lesson is to learn how to enter object attributes for macros and to insert a document macro into the database. This is not a lesson in creating Visual Basic macros.
Windows:
Document Macro Basic
In this exercise, you are going to enter object attributes for object types to be used in the macro code.
Object Type | Attributes |
PlantObject | KEYA |
Project | PROJECT_ID |
Note: The Plant Design and Engineering Project functionalities must be available in your system and these object types should be made document aware for them to be displayed.
In this exercise, you are going to enter document macro blocks. These blocks of code can then be built together into document macros on the Document Macros tab. This makes it possible to reuse blocks of code. The code blocks in this example are written in Visual Basic, but the application also supports Java script.
Block Name | Script |
WORD_INIT | 'Setup some variables'
Dim sMsg sMsg = "Congratulations on your first document macro!" |
WORD_UPDATE | Public Sub View_Word()
MsgBox sMsg End Sub |
Note: You can open a text editor by double-clicking in the Script field. It may help you when you are creating new macros.
In this exercise, you are going to build the blocks that you created in the exercise above into a document macro. This simple macro will display a dialog box when you view a Word document.
Application | Script Language |
Process | Action | Main Function |
Description |
Word (use LOV) |
VBScript | View | TRAINING_VIEW | View_Word | Training macro, displays dialog box. |
- WORD_INIT
- WORD_UPDATE
To be certain that this new macro works properly, you are going to run the macro when viewing a document file.
Document Class |
Document No |
Revision |
500 | %20 | A1 |