Hello,
I have excel sheet and having a chart on it i want to put a button which help to convert that chart portion in to PDF and it will save and send to email id.
Hello,
I have excel sheet and having a chart on it i want to put a button which help to convert that chart portion in to PDF and it will save and send to email id.
an example
![]()
Sub Create_PDF_email_It() Dim strSubject As String, strBody As String, strTo As String, strCC As String Dim Filename As String myPath = ThisWorkbook.Path & "\" strSubject = "Contrat de prêt Choisy à signer" strBody = "Bonjour, veuillez svp signer les DEUX pages du contrat de prêt et me le retourner. Merci!" strTo = Sheets(1).Range("Z6") strCC = Sheets(1).Range("Z7") Sheets("Contrat de prêt").Select ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _ myPath & "Contrat de prêt " & Format(Date, "dd_mm_yyyy") & ".pdf" _ , Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas _ :=False, OpenAfterPublish:=False Filename = myPath & "Contrat de prêt " & Format(Date, "dd_mm_yyyy") & ".pdf" If Filename <> "" Then RDB_Mail_PDF_Outlook Filename, strTo, strCC, strSubject, strBody, False 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 Kill Filename End Sub Function RDB_Mail_PDF_Outlook(FileNamePDF As String, strTo As String, strCC As String, _ strSubject As String, strBody As String, Send As Boolean) Dim OutApp As Object Dim OutMail As Object Set OutApp = CreateObject("Outlook.Application") Set OutMail = OutApp.CreateItem(0) On Error Resume Next With OutMail .To = strTo .CC = strCC .BCC = "" .Subject = strSubject .Body = strBody .Attachments.Add FileNamePDF If Send = True Then .Send Else .Display End If End With On Error GoTo 0 Set OutMail = Nothing Set OutApp = Nothing End Function
If solved remember to mark Thread as solved
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks