mirror of
https://github.com/dfinke/ImportExcel.git
synced 2026-01-20 09:23:56 +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