Object Model Paths: | ActiveDocument.Sections.Count is the correct syntax to access the Count property of the Sections in Active Document, while ActiveDocumentSections.Count generates the following error because the separator between ActiveDocument and Sections is missing: ActiveDocumentSections is not defined |
Methods (and Functions): | Activate() does not take arguments, but the parentheses are still required. ActiveDocument.Sections["RevSummary"].Activate() The Add() method requires a single argument, included in the parentheses. Time.Add(TextBox1.Text) The Alert() method requires at least one argument and allows for multiple optional arguments. Multiple arguments are separated by commas. Application.Alert(TextBox1.Text,"Text Box") |
Properties: Separate properties from objects with a period (.) Refer to one of a collection of properties, by number, in brackets [] Refer to one of a collection of properties, by name, in brackets, with quotes [""]
| When referring to the Count property of document sections, use: ActiveDocument.Sections.Count When referring to the first section (not the name, but the position in the section array in the object model), use: ActiveDocument.Sections[1] When referring to a specific section named RevSummary, use: ActiveDocument.Sections["RevSummary"] |
Statement Separators: Statements must end with a return [Enter] End statements with both a semicolon (;) and a return [Enter] to avoid JavaScript errors Separate short statements on one line with a semicolon (;)
| Statements can be on separate lines: Time.Add(TextBox1.Text);
DropTime.Add(TextBox1.Text); Multiple statements can be on one line, with a semicolon separating them: Time.Add(TextBox1.Text);DropTime.Add(TextBox1.Text); |