View Single Post
 
Old 11-18-2017, 05:52 AM
gmayor's Avatar
gmayor gmayor is offline Windows 10 Office 2016
Expert
 
Join Date: Aug 2014
Posts: 4,138
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

The fact that you are saving the documents as PDF format may have something to do with it.

Try the following instead. I don't think you can dismiss the conversion prompt in VBA. You can dismiss it from the message itself.
Code:
Option Explicit

Sub UpdateDocuments()
    Application.ScreenUpdating = False
    Dim strFolder As String, strFile As String, wdDoc As Document
    Dim strDocName As String
    strFolder = GetFolder
    If strFolder = "" Then Exit Sub
    strFile = Dir$(strFolder & "\*.pdf")
    While strFile <> ""
        Set wdDoc = Documents.Open(FileName:=strFolder & "\" & strFile, AddToRecentFiles:=False, Visible:=False)
        strDocName = Replace(strFile, ".pdf", ".docx")
        wdDoc.SaveAs2 FileName:=strFolder & "\" & strDocName, FileFormat:=wdFormatXMLDocument, AddToRecentFiles:=False
        wdDoc.Close SaveChanges:=wdDoNotSaveChanges
        strFile = Dir$()
    Wend
    Set wdDoc = Nothing
    Application.ScreenUpdating = True
End Sub
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote