Hi I have a macro that creates a PDF then creates an email and sends the pdf. I now need to copy a range of cells and paste them into the body of the email. I have seen examples of copy and paste macros but do not know how to combine that code into the create and send macro.
any help appreciated
Thanks
Thanks - Here is the current code
This was from rondebruin.nl (with a little bit of editing.)
Sub new_save_as()
Dim OlApp As Object
Dim NewMail As Object
Dim TempFilePath As String
Dim TempFileName As String
Dim FileFullPath As String
With Application
.ScreenUpdating = False
.EnableEvents = False
End With
TempFilePath = Environ$("temp") & "\"
TempFileName = "Rewards desk report" & " " & Format(Now - 1, "dd-mmm-yy") & ".pdf"
FileFullPath = TempFilePath & TempFileName
On Error GoTo err
With ActiveSheet
.ExportAsFixedFormat _
Type:=xlTypePDF, _
Filename:=FileFullPath, _
Quality:=xlQualityStandard, _
IncludeDocProperties:=True, _
IgnorePrintAreas:=False, _
OpenAfterPublish:=False
End With
Set OlApp = CreateObject("Outlook.Application")
Set NewMail = OlApp.CreateItem(0)
On Error Resume Next
With NewMail
.To = "address here"
.CC = "address here"
.BCC = ""
.Subject = "Rewards desk daily report"
.Body = "The daily report is attached"
.Attachments.Add FileFullPath
.Display
End With
On Error GoTo 0
Kill FileFullPath
Set NewMail = Nothing
Set OlApp = Nothing
With Application
.ScreenUpdating = True
.EnableEvents = True
End With
MsgBox ("Email has been Sent Successfully")
Exit Sub
err:
MsgBox err.Description
End Sub