I have tried every possible variation I can think of to solve this. I am trying to run a macro through VBA that finds all doc/x files, opens them, exports as a PDF, and then kills the doc/x file(s). Everything works perfectly except for the automation! Every few documents has "Tracking Changes" turned on, and this prompts the user to make sure they want to save the file.
What I have tried:
- Disabling the prompt through the Trust Center
- Word.Application.DisplayAlerts = False
Since I work on a closed and classified system, I can't transfer the code in its entirety, but this is almost exactly how I approached this problem:
Code
[FONT=Courier New][size=10][COLOR=black]Sub doc2pdf()
Dim wordApp as Word.Application[/COLOR][/SIZE][/FONT][FONT=Courier New][size=10][COLOR=black]
Dim wordDoc as Word.Document
Set wordApp = New Word.Application
On Erro GoTo SomeErrorHandler[/COLOR][/SIZE][/FONT][FONT=Courier New][size=10][COLOR=black]
[/COLOR][/SIZE][/FONT] [FONT=Courier New][size=10][COLOR=black]wordApp.Visible = False
[/COLOR][/SIZE][/FONT][FONT=Courier New][size=10][COLOR=black]wordApp.DisplayAlerts = False [COLOR=gray]'Tried both False and wdNone[/COLOR]
[/COLOR][/SIZE][/FONT][FONT=Courier New][size=10][COLOR=black]Set wordDoc = wordApp.Documents.Open(myFile)
[/COLOR][/SIZE][/FONT][FONT=Courier New][size=10][COLOR=black]With wordDoc [COLOR=gray]'Here is where it breaks down, the prompt shows up asking if I want to save the file because it has tracked changes[/COLOR]
[/COLOR][/SIZE][/FONT][FONT=Courier New][size=10][COLOR=black] .ExportAsFixedFormat OutputFileName:= _[/COLOR][/SIZE][/FONT][FONT=Courier New][size=10][COLOR=black]
[/COLOR][/SIZE][/FONT][FONT=Courier New][size=10][COLOR=black] ActiveDocument.Path & "\" & ActiveDocument.Name & ".pdf", ExportFormat:= _[/COLOR][/SIZE][/FONT][FONT=Courier New][size=10][COLOR=black]
[/COLOR][/SIZE][/FONT][FONT=Courier New][size=10][COLOR=black] wdExportFormatPDF, OpenAfterExport:=False, OptimizeFor:= _[/COLOR][/SIZE][/FONT][FONT=Courier New][size=10][COLOR=black]
[/COLOR][/SIZE][/FONT][FONT=Courier New][size=10][COLOR=black] wdExportOptimizeForPrint, Range:=wdExportAllDocument, _[/COLOR][/SIZE][/FONT][FONT=Courier New][size=10][COLOR=black]
[/COLOR][/SIZE][/FONT][FONT=Courier New][size=10][COLOR=black] Item:=wdExportDocumentContent, IncludeDocProps:=False, KeepIRM:=False, _[/COLOR][/SIZE][/FONT][FONT=Courier New][size=10][COLOR=black]
[/COLOR][/SIZE][/FONT][FONT=Courier New][size=10][COLOR=black] CreateBookmarks:=wdExportCreateNoBookmarks, DocStructureTags:=False, _[/COLOR][/SIZE][/FONT][FONT=Courier New][size=10][COLOR=black]
[/COLOR][/SIZE][/FONT][FONT=Courier New][size=10][COLOR=black] BitmapMissingFonts:=True, UseISO19005_1:=False[/COLOR][/SIZE][/FONT][FONT=Courier New][size=10][COLOR=black]
[/COLOR][/SIZE][/FONT][FONT=Courier New][size=10][COLOR=black] .Close SaveChanges:=wdDoNotSaveChanges[/COLOR][/SIZE][/FONT][FONT=Courier New][size=10][COLOR=black]
[/COLOR][/SIZE][/FONT][FONT=Courier New][size=10][COLOR=black]End With[/COLOR][/SIZE][/FONT][FONT=Courier New][size=10][COLOR=black]
[/COLOR][/SIZE][/FONT][FONT=Courier New][size=10][COLOR=black]wordApp.Quit SaveChanges:=wdDoNotSaveChanges[/COLOR][/SIZE][/FONT][FONT=Courier New][size=10][COLOR=black]
[/COLOR][/SIZE][/FONT][FONT=Courier New][size=10][COLOR=black]Set wordApp = Nothing[/COLOR][/SIZE][/FONT][FONT=Courier New][size=10][COLOR=black]
[/COLOR][/SIZE][/FONT][FONT=Courier New][size=10][COLOR=black]Set wordDoc = Nothing[/COLOR][/SIZE][/FONT][FONT=Courier New][size=10][COLOR=black]
[/COLOR][/SIZE][/FONT] [FONT=Arial][COLOR=black][FONT=Courier New][size=10]End Sub[/SIZE][/FONT]
[/COLOR][/FONT]
Display More
Any help is appreciated.
Sorry for the funky spacing, this forum keeps messing up my post.