VincentCrimmins
Programmer
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
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