Defining a macro
To define a macro:
- In the Microsoft Excel template, press ALT - F11 to start the VBA editor.
- In the VBA editor, select the Module to define a new module. menu and from the Insert menu, select
- In the VBA editor window, define a function for each property attribute that you defined
in the template as described in the previous procedure. For property attribute DOC_ID, for
example, enter the following
code:
Function getDOC_ID (temp As Integer) As String getDOC_ID=ActiveWorkbook.CustomDocumentProperties("DOC_ID").Value End Function
Note that the function name, getDOC_ID, consists of two parts:
- get
- DOC_ID
DOC_ID is the name of the property. This macro will fill the cell that is selected in the following procedure.