Copy range into email

  • Thread starter Thread starter tanyhart
  • Start date Start date
T

tanyhart

This is just a portion of my email code. It works well, however ther
is one missing piece.
Where the strbody is being created, the line .Range("D6")...I woul
like it to show both cells D6 and H6, how would I get it to do this o
the one line? As well show the value of H6 as a percentage in th
email. I've tried various ways, but I keep getting type mismatc
errors.

The reason I need it to show both cells is so that the email will read

This estimate shows a contingency of 10% (the percentage is a link t
another sheet in the workbook)


Code
-------------------

Dim OutApp As Outlook.Application
Dim OutMail As Outlook.MailItem
Dim s As String
Dim strbody As String

Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(olMailItem)

With ThisWorkbook.Sheets("Assumptions")
strbody = "Program Manager," & vbNewLine & _
"Please see the attached estimate for the work at XXXX. This estimate is based on the following assumptions." & vbNewLine & vbNewLine & _
.Range("D6") & vbNewLine & _
.Range("D7") & vbNewLine & _
.Range("D8") & vbNewLine & _
.Range("D9") & vbNewLine & _
.Range("D10") & vbNewLine & _
.Range("D11") & vbNewLine & vbNewLine & _
.Range("B13") & vbNewLine & _
.Range("D14") & vbNewLine & _
.Range("D15") & vbNewLine & _
.Range("D16") & vbNewLine & _
.Range("D17") & vbNewLine & _
.Range("D18") & vbNewLine & _
.Range("D19") & vbNewLine & _
.Range("D20") & vbNewLine & _
.Range("D21") & vbNewLine & _
.Range("D22") & vbNewLine & _
.Range("D23")
 
.Range("D6") & vbNewLine & _
.Range("D7") & vbNewLine & _

becomes:

.Range("D6") & " " & format(.range("h6"), "0.00%") & vbnewline & _
.Range("D7") & vbNewLine & _

Use your favorite percent format.
 
Back
Top