API Reference
Command
Close-OfficeWord
Closes a Word document, optionally saving it.
Remarks
Closes a Word document, optionally saving it.
Examples
Close without saving.
PS>$doc = Get-OfficeWord -Path .\Report.docx; Close-OfficeWord -Document $doc
Disposes the loaded document instance without saving changes.
Save to a new path and open the file.
PS>Close-OfficeWord -Document $doc -Save -Path .\Report-final.docx -Show
Saves updates to Report-final.docx, opens it, and disposes the document.
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.
Syntax
Close-OfficeWord -Document <WordDocument> [-Path <String>] [-Save] [-Show] [<CommonParameters>]#Parameter set:
All Parameter SetsParameters
- Document WordDocument
- Word document to close.
- Path String
- Optional target path when saving.
- Save SwitchParameter
- Persist changes before closing.
- Show SwitchParameter
- Open the file after saving.
Outputs
System.Object