Application.ActiveDocument Property

Publisher Developer Reference

Returns a Document object that represents the active publication. If there are no documents open, an error occurs.

Syntax

expression.ActiveDocument

expression   A variable that represents an Application object.

Return Value
Document

Example

This example allows the user to assign a file name to the active publication and save it with the new file name. The file name, along with other text, is then inserted after the currently selected text. (Note that Filename must be replaced with a valid publication name for this example to work.)

Visual Basic for Applications
  Sub NewsLetterSave()
Dim strFileName As String

' Assign the explicit file name to a variable.
strFileName = "<em>Filename</em>"
Publisher.<strong class="bterm">ActiveDocument</strong>.SaveAs strFileName

' Insert the file name and supporting text after selected text.
Selection.TextRange.Collapse pbCollapseEnd
Selection.TextRange = _
    " This publication has been saved as " &amp; strFileName

End Sub

See Also