Application.ActiveDocument property (Publisher)
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.
Sub NewsLetterSave()
Dim strFileName As String
' Assign the explicit file name to a variable.
strFileName = "FileName"
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
Support and feedback
Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.