Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Pasting from Excel into Body of an Outlook Email

Status
Not open for further replies.

VincentCrimmins

Programmer
Jan 16, 2008
37
IE
Hi,

I'm trying to paste a table in Excel into the body of an email, but I don't know what code is required to paste it, any help greatly appreciated!

Code for copying the table and creating the email:

Sub Mailer()

Sheets("Summary").Select
ActiveSheet.Range("Orders").Select
Selection.Copy

Dim objol As New Outlook.Application
Dim objmail As MailItem

Set objol = New Outlook.Application
Set objmail = objol.CreateItem(olmailitem)

With objmail
.To = "" 'enter in here the email address
.CC = "" 'enter in here the email address
.Subject = "Orders" & dname
.Body = "Hello" & _
vbCrLf & "" & _
vbCrLf & "END/" & vbCrLf
.NoAging = True
.Attachments.Add PathName 'adds attachment to email
.display
End With
Set objmail = Nothing
Set objol = Nothing
SendKeys "%{s}", True 'send the email without prompts, change to False if you want prompting

End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top