Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default 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
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
can I copy a column of email addresses, paste into email address? Lizizfree New Users to Excel 4 July 20th 06 10:03 PM
send email with email addresses in a range of cells Craig[_24_] Excel Programming 1 October 10th 05 09:26 PM
Copy and email Saeed[_3_] Excel Programming 3 June 13th 05 04:43 PM
Macro - Copy - Email John Excel Worksheet Functions 1 March 2nd 05 07:36 PM
Copy and Paste a Worksheet Range to Email Body Eric[_14_] Excel Programming 1 January 20th 04 12:06 AM


All times are GMT +1. The time now is 07:16 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"