API Reference
Command
Close-OfficeExcel
Closes an Excel workbook and optionally saves it.
Remarks
Closes an Excel workbook and optionally saves it.
Examples
Save to a new path and open the file.
PS>Close-OfficeExcel -Document $workbook -Save -Path .\report-final.xlsx -Show
Saves pending changes to a new file, launches Excel, and releases the workbook.
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-OfficeExcel -Document <ExcelDocument> [-Path <String>] [-Save] [-Show] [<CommonParameters>]#Parameter set:
All Parameter SetsParameters
- Document ExcelDocument
- Workbook to close.
- Path String
- Optional output path when saving.
- Save SwitchParameter
- Persist changes before closing.
- Show SwitchParameter
- Open the workbook in Excel after saving.
Outputs
System.Object