SaveAs Method

Microsoft Publisher Visual Basic

expression.SaveAs([FileName], [Format], [AddToRecentFiles])

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

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.

PbFileFormat can be one of these PbFileFormat constants.
pbFileHTMLFiltered
pbFilePublication default
pbFilePublicationHTML
pbFilePublisher2000
pbFilePublisher98
pbFileRTF
pbFileWebArchive

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 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