Saturday, December 31, 2016

vba - Excel macro stopped working after Windows update kb4103729

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"

Else

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, _
OpenPDFAfterPublish:=False)

'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
'FixedFilePathName:="C:\Users\Ron\Test\YourPdfFile.pdf"

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:="Beste " & Range("Template!H3").Value & ",

" & _
"In bijlage vindt u de meest recente factuur voor de dienstverlening " & Range("Template!B12").Value & "." & _
"
" & "...Bunch of body text" & _
"

Else
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

No comments:

Post a Comment

hard drive - Leaving bad sectors in unformatted partition?

Laptop was acting really weird, and copy and seek times were really slow, so I decided to scan the hard drive surface. I have a couple hundr...