2
votes

In VBA I am cycling through thousands of documents. The script stalls when it hits a document needomg repair. A dialog box opens entitled: "Show Repairs" with the message: "Errors were detected in thsi file, but Word was able to open the file by making the repairs listed below. Save the file to make the repairs permanent".

How do I override the dialog box? I am happy to skip the document altogether. Below is what I tried.

Application.DisplayAlerts = False
Set wrdDoc = wrdApp.Documents.Open(fileName:=strMyFile, PasswordDocument:="?#nonsense@$", ReadOnly:=True, OpenAndRepair:=False)
plication.DisplayAlerts = True
1

1 Answers

5
votes

Ok the solution is to use Documents.OpenNoRepairDialog instead of Documents.Open. That simple. Apparently.