Exception to the code-entry rule: If you plan to use an object model path repeatedly, define it as a variable, to save space and create a compact script.
ActiveDocument.Sections["Query"].DataModel.Connection.Username = "hyperion" ActiveDocument.Sections["Query"].DataModel.Connection.SetPassword("hyperion")ActiveDocument.Sections["Query"].DataModel.Connection.Connect
DMPath = ActiveDocument.Sections["Query"].DataModel.Connection DMPath.Username = "hyperion" DMPath.SetPassword("hyperion") DMPath.Connect
Treat space-saving variables as object model paths. That is, insert periods between object model segments, and do not add unnecessary spaces.
Also, include only objects in the path; that is, do not include methods or property segments for the objects:
Example—Incorrect script, because ActiveDocument.Sections["Query"].Limits does not have an Activate() method: