Since Windows version 1803 update kb4103729 my Macro for generating a pdf of and mailing an invoice stopped working. It's a Macro with multiple commands in it and references to both the worksheet and a destination folder (see below).

I've checked all the references and ran all the solutions I could find here: deleting all .exd files, and changing the language settings for running VBA code (the update affects language packs and I'm running a Dutch version of excel). I hope someone can help me on this one.

The issue seems to be specific to this Macro (all versions I have of it, one for credit notes and two for invoices in other languages, are affected, but not the other Macros). It keeps giving me the second error box ("Not possible to create the PDF, possible reasons:...").

Here's the Macro:

Sub Create_PDFmail() Dim FileName As String

If ActiveWindow.SelectedSheets.Count > 1 Then
    MsgBox "There is more then one sheet selected," & vbNewLine & _
           "ungroup the sheets and try the macro again"

    FileName = RDB_Create_PDF(Source:=Range("A1:F39"), _
                              FixedFilePathName:="C:\Users\woute\SharePoint\CareerCoach - Admin\Boekhouding\Verkoopfacturen\CC Factuur " & ThisWorkbook.Sheets("Template").Range("Template!E11").Value & ".pdf", _
                              OverwriteIfFileExist:=True, _

    'For the selection use Selection in the Source argument
    'FileName = RDB_Create_PDF(Source:=Selection)

    'For a fixed file name use this in the FixedFilePathName argument

    If FileName <> "" Then
        RDB_Mail_PDF_Outlook FileNamePDF:=FileName, _
                             StrTo:=ThisWorkbook.Sheets("Template").Range("Template!H2").Value, _
                             StrCC:="", _
                             StrBCC:="", _
                             StrSubject:="factuur " & ThisWorkbook.Sheets("Template").Range("Template!E11").Value, _
                             Signature:=True, _
                             Send:=False, _
                             StrBody:="<body>Beste " & Range("Template!H3").Value & ",<br><br>" & _
                                        "In bijlage vindt u de meest recente factuur voor de dienstverlening <b><i>" & Range("Template!B12").Value & ".</i></b>" & _
                                        "<br>" & "...Bunch of body text" & _

        MsgBox "Not possible to create the PDF, possible reasons:" & vbNewLine & _
               "Microsoft Add-in is not installed" & vbNewLine & _
               "You Canceled the GetSaveAsFilename dialog" & vbNewLine & _
               "The path to Save the file in arg 2 is not correct" & vbNewLine & _
               "You didn't want to overwrite the existing PDF if it exist"
    End If
End If

End Sub

  • KB4103729 is a Adobe Flash Player update, which means, it isn't the cause of this behavior. – Ramhound Jun 4 '18 at 23:08
  • 1
    You should remove then reinstall the RDBMail Add-in. I am guessing Office was updated without you knowing. – Ramhound Jun 4 '18 at 23:17
  • @Ramhound Thanks for the quick answer. Tried it and indeed the add-in was removed, but still didn't fix the problem. – WouterVB Jun 5 '18 at 11:27
  • You are going to have to supply us more information because I can guarantee you that the KB4103729 is not the cause of your macro not working. I would reverify everything you did before when the add-in wasn't installed – Ramhound Jun 5 '18 at 16:05

I had the same problem and solved it by doing the following:

Windows+R and execute %COMMONPROGRAMFILES%

Then go to "Microsoft Shared", now find the EXP_PDF.DLL in either OFFICEXX folder and copy it to the OFFICE16 folder.

Try your macro.

If it is not working, you can still comment the lines testing the installation of the add-in (First If block and last EndIf block) in the RDB_create_PDF function declare :

    Function RDB_Create_PDF(Myvar As Object, FixedFilePathName As String, _
             OverwriteIfFileExist As Boolean, OpenPDFAfterPublish As Boolean) As String
Dim FileFormatstr As String
Dim Fname As Variant

'Test to see if the Microsoft Create/Send add-in is installed.
If Dir(Environ("commonprogramfiles") & "\Microsoft Shared\OFFICE" _
     & Format(Val(Application.Version), "00") & "\EXP_PDF.DLL") <> "" Then

    If FixedFilePathName = "" Then
        'Open the GetSaveAsFilename dialog to enter a file name for the PDF file.
        FileFormatstr = "PDF Files (*.pdf), *.pdf"
        Fname = Application.GetSaveAsFilename("", filefilter:=FileFormatstr, _
              Title:="Create PDF")

        'If you cancel this dialog, exit the function.
        If Fname = False Then Exit Function
        Fname = FixedFilePathName
    End If

    'If OverwriteIfFileExist = False then test to see if the PDF
    'already exists in the folder and exit the function if it does.
    If OverwriteIfFileExist = False Then
        If Dir(Fname) <> "" Then Exit Function
    End If

    'Now export the PDF file.
    On Error Resume Next
    Myvar.ExportAsFixedFormat _
            Type:=xlTypePDF, _
            Filename:=Fname, _
            Quality:=xlQualityStandard, _
            IncludeDocProperties:=True, _
            IgnorePrintAreas:=False, _
    On Error GoTo 0

    'If the export is successful, return the file name.
    If Dir(Fname) <> "" Then RDB_Create_PDF = Fname
End If
End Function

Hope this helps, if still needed.

  • Thanks, this finally solved the issue (had in fact already given up on it a while ago. Apparently I have both a Program files and a Program Files X86 folder even though it is a 64-bit machine, so I pasted it in the Programfiles/commonfiles/Microsoftshared/Office15, Programfiles(x86)/Commonfiles/Microsoftshared/Office16 and the Windows/SysWow64 folder. That did the trick. You've made my weekend :-) – WouterVB Nov 18 '18 at 13:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.