Save Method

Microsoft Word Visual Basic

Show All

Save Method

       

Save method as it applies to the Versions object.

Saves a version of the specified document with a comment.

expression.Save(Comment)

expression   Required. An expression that returns one of the above objects.

Comment  Optional Variant.

 

Save method as it applies to the Documents object.

Saves all the documents in the Documents collection. If a document hasn't been saved before, the Save As dialog box prompts the user for a file name.

expression.Save(NoPrompt, OriginalFormat)

expression   Required. An expression that returns one of the above objects.

NoPrompt  Optional Variant. True to have Word automatically save all documents. False to have Word prompt the user to save each document that has changed since it was last saved.

OriginalFormat  Optional Variant. Specifies the way the documents are saved. WdOriginalFormat

Can be one of the following WdOriginalFormat constants
wdOriginalDocumentFormat
wdPromptUserX
wdWordDocument

Save method as it applies to the Document and Template objects.

Saves the specified document or template. If the document or template hasn't been saved before, the Save As dialog box prompts the user for a file name.

expression.Save

expression   Required. An expression that returns one of the above objects.

 

Example

As it applies to the Document object.

This example saves the active document if it's changed since it was last saved.

If ActiveDocument.Saved = False Then ActiveDocument.Save

This example saves each document in the Documents collection without first prompting the user.

Documents.Save NoPrompt:=True, _
    OriginalFormat:=wdOriginalDocumentFormat

As it applies to the Version object.

If Sales.doc is open, this example saves a version of Sales.doc, with a comment.

For Each doc in Documents
    If Instr(1, doc.Name, "Sales.doc", 1) > 0 Then 
        doc.Versions.Save Comment:="Minor changes to intro"
    End If
Next doc