refactor: Replace SaveAs2 with standard SaveAs method in Excel conversion

This commit is contained in:
Bobby Abellana (aider) 2025-02-21 11:03:55 -08:00
parent cc887b4d3e
commit b8049f6f85

View File

@ -494,22 +494,8 @@ function Convert-Files {
$xlOpenXMLWorkbook = 51 # Excel constant for XLSX format
$xlNormal = 1 # Excel constant for normal save
# Use the Excel Application SaveAs2 method
$workbook.SaveAs2(
$excelXlsxPath,
$xlOpenXMLWorkbook, # FileFormat = xlsx
$null, # Password
$null, # WriteResPassword
$false, # ReadOnlyRecommended
$null, # CreateBackup
$xlNormal, # AccessMode
$null, # ConflictResolution
$true, # AddToMru
$null, # TextCodepage
$null, # TextVisualLayout
$false # Local
)
# Use the standard SaveAs method
$workbook.SaveAs($excelXlsxPath, $xlOpenXMLWorkbook)
$workbook.Close($true) # True to save changes
Start-Sleep -Seconds 2 # Give Excel more time to finish saving