OfficeIMO

API Reference

Command

Close-OfficeExcel

Namespace PSWriteOffice
Inputs
OfficeIMO.Excel.ExcelDocument
Outputs
System.Object

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 Sets

Parameters

Document ExcelDocument requiredposition: namedpipeline: True (ByValue)
Workbook to close.
Path String optionalposition: namedpipeline: False
Optional output path when saving.
Save SwitchParameter optionalposition: namedpipeline: False
Persist changes before closing.
Show SwitchParameter optionalposition: namedpipeline: False
Open the workbook in Excel after saving.

Outputs

System.Object