0

I have data in an excel sheet, with row headers and respective values in the columns. I want that to be copied in a tabular format and be pasted in the body of the outlook email along with a few texts. unable to find tabular code for vba. suggest

here is the snippet:

strEmailSubject = ""
StrEmailText = ""
strCc = ""
strContactEmail = ""

With olNewEmail
.To = strContactEmail
'.CC = strCc
.body = StrEmailText
.Subject = strEmailSubject
.display
End With
Martijn Pieters
  • 1,048,767
  • 296
  • 4,058
  • 3,343
akash
  • 13
  • 1
  • 8
  • Look at this [Link](http://stackoverflow.com/questions/18663127/paste-specific-excel-range-in-outlook) it maybe what you looking for – 0m3r Jun 14 '15 at 23:08

2 Answers2

0

The Outlook object model provides three main ways for working item bodies:

  1. Body - a string representing the clear-text body of the Outlook item.
  2. HTMLBody - a string representing the HTML body of the specified item.
  3. Word editor - the Microsoft Word Document Object Model of the message being displayed. The WordEditor property of the Inspector class returns an instance of the Document class from the Word object model which you can use to set up the message body.

You can read more about all these ways in the Chapter 17: Working with Item Bodies. It us up to you which way is to choose to customize the message body. But the last two ways allows to create a table.

Note, you may consider using the Word object model - just copying the required range in Excel and pasting it in the Word Document from the clipboard programmatically.

Eugene Astafiev
  • 47,483
  • 3
  • 24
  • 45
0

Thank you.

just used loops with "with" and " sendkeys method to paste it accordingly.

Cheers

akash
  • 13
  • 1
  • 8