I’m using a PowerShell script to batch convert Word document to Pdfs.
The conversion part of the script is (if required I can paste the whole script):
$word = New-Object -ComObject "word.application"
$outputFile = $outputDirectory + "\" + "myPdf.pdf"
$doc = $word.documents.Open($inputFile, $refFalse, $true) # open in background - No UI
$doc.SaveAs([ref]$outputFile, [ref]17) #17 is for PDF
$doc.Saved = $true
write-host "Processed $outputFile" -foregroundcolor Green
$doc.Close()
$word.Quit()
The script is working quite well, but some of the source documents are corrupted.
When Word detects one of these documents, it displays the repair dialog. This causes my script to be blocked until the user close the dialog.
How can I prevent this dialog ?
[Edit] here is a screenshot of the dialog

I was simply looking at the wrong direction.
There is no parameter of the Open method allowing to disable this dialog, but I found there is another method : OpenNoRepairDialog.
Simple… just have to look around a bit