Export (0) Print
Expand All
Expand Minimize

_Document.SaveAs Method

Saves the specified document with a new name or format. Some of the arguments for this method correspond to the options in the Save Asdialog box (File menu).

Namespace:  Microsoft.Office.Interop.Word
Assembly:  Microsoft.Office.Interop.Word (in Microsoft.Office.Interop.Word.dll)

void SaveAs(
	ref Object FileName,
	ref Object FileFormat,
	ref Object LockComments,
	ref Object Password,
	ref Object AddToRecentFiles,
	ref Object WritePassword,
	ref Object ReadOnlyRecommended,
	ref Object EmbedTrueTypeFonts,
	ref Object SaveNativePictureFormat,
	ref Object SaveFormsData,
	ref Object SaveAsAOCELetter,
	ref Object Encoding,
	ref Object InsertLineBreaks,
	ref Object AllowSubstitutions,
	ref Object LineEnding,
	ref Object AddBiDiMarks
)

Parameters

FileName
Type: System.Object%
Optional Object. The name for the document. The default is the current folder and file name. If the document has never been saved, the default name is used (for example, Doc1.doc). If a document with the specified file name already exists, the document is overwritten without the user being prompted first.
FileFormat
Type: System.Object%
Optional Object. The format in which the document is saved. Can be any WdSaveFormat constant. To save a document in another format, specify the appropriate value for the SaveFormat property of the FileConverter object.
LockComments
Type: System.Object%
Optional Object. True to lock the document for comments. The default is False.
Password
Type: System.Object%
Optional Object. A password string for opening the document. (See Remarks below.)
AddToRecentFiles
Type: System.Object%
Optional Object. True to add the document to the list of recently used files on the File menu. The default is True.
WritePassword
Type: System.Object%
Optional Object. A password string for saving changes to the document. (See Remarks below.)
ReadOnlyRecommended
Type: System.Object%
Optional Object. True to have Microsoft Word suggest read-only status whenever the document is opened. The default is False.
EmbedTrueTypeFonts
Type: System.Object%
Optional Object. True to save TrueType fonts with the document. If omitted, the EmbedTrueTypeFonts argument assumes the value of the EmbedTrueTypeFonts property.
SaveNativePictureFormat
Type: System.Object%
Optional Object. If graphics were imported from another platform (for example, Macintosh), True to save only the Windows version of the imported graphics.
SaveFormsData
Type: System.Object%
Optional Object. True to save the data entered by a user in a form as a data record.
SaveAsAOCELetter
Type: System.Object%
Optional Object. If the document has an attached mailer, True to save the document as an AOCE letter (the mailer is saved).
Encoding
Type: System.Object%
Optional MsoEncoding. The code page, or character set, to use for documents saved as encoded text files. The default is the system code page.
InsertLineBreaks
Type: System.Object%
Optional Object. If the document is saved as a text file, True to insert line breaks at the end of each line of text.
AllowSubstitutions
Type: System.Object%
Optional Object. If the document is saved as a text file, True allows Word to replace some symbols with text that looks similar. For example, displaying the copyright symbol as (c). The default is False.
LineEnding
Type: System.Object%
Optional Object. The way Word marks the line and paragraph breaks in documents saved as text files. Can be any WdLineEndingType constant.
AddBiDiMarks
Type: System.Object%
Optional Object. True adds control characters to the output file to preserve bi-directional layout of the text in the original document.

Avoid using hard-coded passwords in your applications. If a password is required in a procedure, request the password from the user, store it in a variable, and then use the variable in your code.

Community Additions

ADD
Show:
© 2014 Microsoft