Hi guys,
Below is what i am currently using on my worksheet to save a selected cell range then automatically email it to my clients. It works fine but I want to review the file and also sometimes I want to write something more in the email I am sending to clients using the code below.
So, there are two things I want to achieve here, if someone can rewirte or add anything to the code given below to make what I want to happen, I will be highly appreciated.
First, I want to save the selected range of cells in a pdf format to the following path:
"C:/User/Jin/Desktop/DDD"
Second, I still want the automated email function to remain active but do not send emails out before I click send button (like how we normally send emails using outlook).
Can anyone help??
Thanks
Sub SendMailWithPDF()
'** refer to: Microsoft Outook 12.0 Object Libray
Dim OutlookApp As Outlook.Application
Dim myMailtem As Outlook.MailItem
Dim myTo As String
Dim mySubject As String
Dim Msg As String
Dim Fname As String
myTo = Range("V2")
mySubject = "Quote" & Range("V3")
Msg = "Hi, " & Range("J9") & Chr(10) & Chr(10) & _
"Please find the attachment above." & Chr(10) & Chr(10) & _
"Regards," & Chr(10) & _
Fname = Application.DefaultFilePath & "\" & Range("J9").Value & ".pdf"
ActiveSheet.Range("A1:R71").ExportAsFixedFormat Type:=xlTypePDF, Filename:=Fname
Set OutlookApp = New Outlook.Application
Set myMailitem = OutlookApp.CreateItem(olMailItem)
With myMailitem
.To = myTo
.Subject = mySubject
.Body = Msg
.Attachments.Add Fname
.Save
.Send
End With
Set OutlookApp = Nothing
Kill Fname
End Sub
Bookmarks