![]() |
Copy range into email
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") ------------------- Thanks for all hel -- tanyhar ----------------------------------------------------------------------- tanyhart's Profile: http://www.excelforum.com/member.php...fo&userid=3514 View this thread: http://www.excelforum.com/showthread.php?threadid=56526 |
Copy range into email
.Range("D6") & vbNewLine & _
.Range("D7") & vbNewLine & _ becomes: .Range("D6") & " " & format(.range("h6"), "0.00%") & vbnewline & _ .Range("D7") & vbNewLine & _ Use your favorite percent format. tanyhart wrote: This is just a portion of my email code. It works well, however there is one missing piece. Where the strbody is being created, the line .Range("D6")...I would like it to show both cells D6 and H6, how would I get it to do this on the one line? As well show the value of H6 as a percentage in the email. I've tried various ways, but I keep getting type mismatch 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 to 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") -------------------- Thanks for all help -- tanyhart ------------------------------------------------------------------------ tanyhart's Profile: http://www.excelforum.com/member.php...o&userid=35148 View this thread: http://www.excelforum.com/showthread...hreadid=565264 -- Dave Peterson |
Copy range into email
Thanks so much for the help, I really appreciate it. -- tanyhart ------------------------------------------------------------------------ tanyhart's Profile: http://www.excelforum.com/member.php...o&userid=35148 View this thread: http://www.excelforum.com/showthread...hreadid=565264 |
All times are GMT +1. The time now is 09:27 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com