Sub RDB_Selection_Range_To_PDF_And_Create_Mail()
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
'Call the function with the correct arguments
'For a fixed range use this line
FileName = RDB_Create_PDF(Range("A1:I280"), "", True, False)
'For the selection use this line
'FileName = RDB_Create_PDF(Selection, "", True, True)
'For a fixed file name and overwrite it each time you run the macro use
'RDB_Create_PDF(Selection, "C:\Users\Ron\Test\YourPdfFile.pdf", True, True)
If FileName <> "" Then
RDB_Mail_PDF_Outlook FileName, "ron@debruin.nl", "Défi Expert - Votre résultat", _
"Merci d'avoir répondu au questionnaire!" _
& vbNewLine & vbNewLine & "Le service de la formation", True
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