Skip to content

Commit

Permalink
check for null first
Browse files Browse the repository at this point in the history
  • Loading branch information
edwardmiller-mesirow committed May 18, 2024
1 parent 722516d commit 36b5495
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion Public/ConvertTo-ExcelXlsx.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
}
Expand Down

0 comments on commit 36b5495

Please sign in to comment.