none
Open PDF in Word without Conversion Message

    Question

  • I would like to open a PDF file inside of Word 2013 from an Excel Spreadsheet.  I have this working with the exception of a dialog box that pops up when I open the PDF file.  Is there any way to not have this dialog box show up?

    code:

    Set oDoc = oWord.Documents.Open(Filename:=strPathFilename, ConfirmConversions:=False, ReadOnly:=True)

    Dialog Box Message:

    Word will now convert your PDF to an editable Word document.  This may take a while.  The resulting Word document will be optimized to allow you to edit the text, so it might not look exactly like the original PDF, especially if the original file contained lots of graphics.

    There is a "Don't show this message again" check box; however, I don't want the user to even see this dialog as it is part of a long running application that will hang until it is responded to.

    Basically, I don't want the user to see that message when opening the file.  Is there any way to do this? 

    ConfirmConversions - is for a different conversion window that doesn't look like it is normally seen any longer.


    Bob

    Monday, March 04, 2013 2:59 PM

All replies

  • Maybe there is another way to specify the open since I already know that it is a PDF file and I wan to open it Word - Documents.Open that won't display this message?

    http://msdn.microsoft.com/en-us/library/office/ff835182.aspx


    Bob

    Monday, March 04, 2013 3:07 PM
  • Hi Bob,

    Would you please try to use Application.DisplayAlerts=False before the Open action? Don't forget to turn it back after the Open.

    Application.DisplayAlerts = wdAlertsNone
    ...Open action
    Application.DisplayAlerts = wdAlertsAll

    Good day.


    Yoyo Jiang[MSFT]
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    • Marked as answer by Boblam Thursday, March 07, 2013 8:14 PM
    • Unmarked as answer by Boblam Saturday, March 12, 2016 4:27 PM
    Wednesday, March 06, 2013 9:40 AM
    Moderator
  • I have the same issue Bob has, I'm using Word 2013 and the displayalerts=wdAlertsNone , doesn't work when I open a pdf file on word. I've got the same "Word will now convert your PDF to an editable Word document.  This may take a while.  The resulting Word document will be optimized to allow you to edit the text, so it might not look exactly like the original PDF, especially if the original file contained lots of graphics."  , please help me
    Wednesday, November 25, 2015 4:00 PM
  • Sorry, I never found an answer.  The ideas above do not work.

    Bob

    Monday, December 14, 2015 2:16 AM
  • If it doesn't work, please remove the "Answered" check you placed on YoYo Jiang's replies. Only you can do that. The Microsoft team is going to think it's all OK once you've clicked the "Answer" link...

    Cindy Meister, Office Developer/Word MVP, <a href="http://blogs.msmvps.com/wordmeister"> my blog</a>

    Monday, March 07, 2016 5:26 PM
  • I unmarked the answer as you suggested.

    Bob

    Saturday, March 12, 2016 4:28 PM
  • When you check the PDF warning check box it writes the following value to the registry (Word 2013 shown)

    HKEY_CURRENT_USER\SOFTWARE\Microsoft\Office\15.0\Word\Options\DisableConvertPdfWarning: 0x00000001

    Initially that key doesn't exist, so you can check whether the key exists or ascertain its current value and process the key accordingly - see below.

    You can remove the message boxes when you have tested.

    Option Explicit
    
    Sub DisablePDFWarning()
    Dim WSHShell As Object
    Dim RegKey As String
    Dim wVer As String
    Dim strValue As String
    Dim bSwitch As Boolean
        If Val(Application.Version) < 15 Then
            MsgBox "This macro is for Word 2013 and later!", vbOKOnly, "Wrong Word Version"
            GoTo lbl_Exit
        End If
    
        Set WSHShell = CreateObject("WScript.Shell")
        wVer = Application.Version
        RegKey = "HKCU\SOFTWARE\Microsoft\Office\" & wVer & "\Word\Options\"
    
        strValue = GetKeyValue
        Select Case strValue
            Case vbNullString, "0"
                WSHShell.regwrite RegKey & "DisableConvertPdfWarning", 1, "REG_DWORD"
                MsgBox "Convert PDF warning is switched off", vbInformation, "PDF Check"
                bSwitch = True
            Case Else
        End Select
    ''''''''''''''''''''''''''''''''''''''''''''''''''
        'Run your process here
        
    ''''''''''''''''''''''''''''''''''''''''''''''''''
        
        If bSwitch Then 'Reset the setting as you found it
            WSHShell.regwrite RegKey & "DisableConvertPdfWarning", 0, "REG_DWORD"
            MsgBox "Convert PDF warning is switched on", vbInformation, "PDF Check"
        End If
    lbl_Exit:
        Set WSHShell = Nothing
        Exit Sub
    End Sub
    
    Private Function GetKeyValue() As String
    Dim WSHShell As Object
    Dim RegKey As String
    Dim wVer As String
        Set WSHShell = CreateObject("WScript.Shell")
        wVer = Application.Version
        RegKey = "HKCU\SOFTWARE\Microsoft\Office\" & wVer & "\Word\Options\"
        On Error GoTo err_handler
        GetKeyValue = WSHShell.RegRead(RegKey & "DisableConvertPdfWarning")
    lbl_Exit:
        Set WSHShell = Nothing
        Exit Function
    err_handler:
        GetKeyValue = vbNullString
        Err.Clear
        GoTo lbl_Exit
    End Function



    Graham Mayor - Word MVP
    www.gmayor.com


    Sunday, March 13, 2016 9:45 AM