ActiveDocument Property

       

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

expression.ActiveDocument

expression   Required. An expression that returns one of the objects in the Applies To list.

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.

Sub NewsLetterSave()

    Dim strFileName As String

    ' Assign the explicit file name to a variable.
    strFileName = "NewsLetter3.pub"
    Publisher.ActiveDocument.SaveAs strFileName

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

End Sub