diff --git a/Client/Out-Word.ps1 b/Client/Out-Word.ps1 index 4312f7f..64c2ccb 100644 --- a/Client/Out-Word.ps1 +++ b/Client/Out-Word.ps1 @@ -305,7 +305,15 @@ https://github.com/samratashok/nishang ForEach ($WordFile in $WordFiles) { $Word = New-Object -ComObject Word.Application - $Word.DisplayAlerts = $False + $WordVersion = $Word.Version + if (($WordVersion -eq "12.0") -or ($WordVersion -eq "11.0")) + { + $Word.DisplayAlerts = $False + } + else + { + $Word.DisplayAlerts = "wdAlertsNone" + } $Doc = $Word.Documents.Open($WordFile.FullName) $DocModule = $Doc.VBProject.VBComponents.Item(1) $DocModule.CodeModule.AddFromString($code_one) @@ -325,7 +333,7 @@ https://github.com/samratashok/nishang } else { - $Doc.Saveas([ref]$SavePath, 0) + $Doc.Saveas([ref]$SavePath, [ref]0) } Write-Output "Saved to file $SavePath" $Doc.Close()