In principle, only the known identifiers in the normal document text can be replaced by the applet. Identifiers in, for example, size specifications for objects, page numbers, etc. are not evaluated. This is due to the fact that in many properties — which are usually set in Word via dialog boxes — no identifiers can be entered, because Word expects a number, for example.
With the help of macros, the problem can be avoided: Let the Scopeland applet write the desired property value into a bookmark in the normal document text. A macro reads this bookmark when the document is opened, sets the corresponding document property and then deletes the bookmark.
The following example macro does this for the start page number of the section in which the bookmark firstPageNumber is located:
Sub SetStartingPageNumber() ' Declare text area r Dim r As range ' Finding the bookmark with the name firstPageNumber ' and remember the area of the text Set r = ActiveDocument.Bookmarks("firstPageNumber").range ' For security reasons, check whether the text area is a valid page
' number If IsNumeric(r.Text) Then ' Take the first section of a document that the text area spans(r.Sections(1)) 'and set the start value of the page numbering of its footers r.Sections(1).Footers(wdHeaderFooterPrimary).PageNumbers.StartingNumber = r.Text ' Delete the bookmark from the document r.Text = "" End If End Sub ' Run the macro when opening the document Sub AutoOpen() Call SetStartingPageNumber End Sub
A bookmark can be inserted into Word via developer tools | pre-version tools | text field (form control) and edited with a double-click.