mirror of
https://github.com/dfinke/ImportExcel.git
synced 2025-12-06 00:23:20 +00:00
check for null first
This commit is contained in:
@@ -51,7 +51,10 @@ function ConvertTo-ExcelXlsx {
|
||||
$Excel.ActiveWorkbook.SaveAs($xlsxPath, $xlFixedFormat)
|
||||
}
|
||||
finally {
|
||||
$Excel.ActiveWorkbook.Close()
|
||||
if ($null -ne $Excel.ActiveWorkbook) {
|
||||
$Excel.ActiveWorkbook.Close()
|
||||
}
|
||||
|
||||
$Excel.Quit()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user