Document.SaveAs method (Publisher)

Saves the specified publication with a new name or format.

Syntax

expression.SaveAs (FileName, Format, AddToRecentFiles)

expression A variable that represents a Document object.

Parameters

Name Required/Optional Data type Description
FileName Optional Variant The name for the publication. The default is the current folder and file name. If the publication has never been saved, the default name is used, for example, Publication1.pub. If a publication with the specified file name already exists, the publication is overwritten without the user being prompted first.
Format Optional PbFileFormat The format in which the publication is saved. Can be one of the PbFileFormat constants declared in the Microsoft Publisher type library. The default is pbFilePublication.
AddToRecentFiles Optional Boolean True to add the publication to the list of recently used files on the File menu. Default is True.

Remarks

If there is insufficient memory or disk space to save the file, an error occurs.

Calling the SaveAs method always performs saves in the foreground regardless of whether background saves are enabled.

Example

This example saves the active publication as a Microsoft Publisher 2000 file.

ActiveDocument.SaveAs FileName:="ReportPub2000.pub", Format:=pbFilePublisher2000

This example saves the active publication as Test.rtf in Rich Text Format (RTF).

ActiveDocument.SaveAs FileName:="Test.rtf", Format:=pbFileRTF

This example saves the active web publication as a set of filtered HTML pages and supporting files. Note that the .htm extension is automatically added to the value of the FileName parameter if the value of the Format parameter is pbFileHTMLFiltered.

With ActiveDocument 
 .SaveAs Filename:="CompanyContacts", Format:=pbFileHTMLFiltered 
End With

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.