Skip to main content

Search OfficeIMO

Enter a topic, API type, or PowerShell command.

Documentation Search all OfficeIMO/
Cmdlet

Save-OfficeWord

Module
PSWriteOffice
Inputs
OfficeIMO.Word.WordDocument
Outputs
System.IO.FileInfo

Saves a live Word document without closing it.

Syntax

Save-OfficeWord
[-AllowLoss]
[-Document] <WordDocument>
[-PassThru]
[-Password <SecureString>]
[[-Path] <String>]
[-Show]
[<CommonParameters>]
#
Parameter set: Document

Description

Uses the supplied path or associated destination. Omitted Password preserves loaded encryption. PassThru returns the saved FileInfo. The document must use explicit persistence.

Examples

Save and retain the live document for further editing.

Save-OfficeWord -Document $document -Path ./Report.docx -PassThru
Close-OfficeWord -Document $document

Save a loaded document with its existing encryption.

$document = Open-OfficeWord -Path ./Protected.docx -Password (Read-Host -AsSecureString)
$document | Save-OfficeWord
$document | Close-OfficeWord

Parameters

-AllowLoss SwitchParameter optional
Explicitly accept reported native-save reductions.
-Document WordDocument requiredposition: 0pipeline: True (ByValue)
Live Word document to save.
-PassThru SwitchParameter optional
Return the saved FileInfo.
-Password SecureString optional
Override the output password; omission preserves the document's loaded encryption.
-Path String optionalposition: 1
Optional new destination; omission uses the associated path.
-Show SwitchParameter optional
Open the saved file in its registered default application.

Common Parameters

This command supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable.

For more information, see about_CommonParameters.