Range for Body of E-Mail

Status
Not open for further replies.
B

BillCPA

I am trying to use a range of cells in Excel as the body for an e-mail in

Outlook. The name for the range is 'DuesReceipt'. It doesn't seem to like

setting olBody to the range. Can someone help?

Public olToName As String

Public olccName As String

Public olbccName As String

Public olSubject As String

Public olBody As String

Public olRange As Object

Public olAttach1 As String

Sub SendReceipt()

Dim olApp As Outlook.Application

Dim olMail As MailItem

Dim SigString As String

Dim Signature As String

Dim xx As Integer

Dim yy As Integer

Dim zz As Integer

Set olApp = New Outlook.Application

SigString = "C:\Documents and Settings\...\Signatures\BillLong.txt"

If Dir(SigString) = "" Then

Signature = GetBoiler(SigString)

Else

Signature = ""

End If

olToName = Range("K5").Value

olSubject = "Dues Receipt"

Set olRange = Range("DuesReceipt")

Set olMail = olApp.CreateItem(olMailItem)

With olMail

> To = olToName

> Subject = olSubject

> Body = olRange

> Send

End With

Set olMail = Nothing

Set olApp = Nothing

End Sub

Bill @ UAMS
 
S

Sue Mosher [MVP]

Have you tried using the Text property of the range?

Sue Mosher

"BillCPA" <Bill @ UAMS> wrote in message

news:21B7CA5A-5C70-488F-ACEB-2F3CB305F131@microsoft.com...
> I am trying to use a range of cells in Excel as the body for an e-mail in
> Outlook. The name for the range is 'DuesReceipt'. It doesn't seem to
> like
> setting olBody to the range. Can someone help?

> Public olToName As String
> Public olccName As String
> Public olbccName As String
> Public olSubject As String
> Public olBody As String
> Public olRange As Object
> Public olAttach1 As String

> Sub SendReceipt()

> Dim olApp As Outlook.Application
> Dim olMail As MailItem
> Dim SigString As String
> Dim Signature As String

> Dim xx As Integer
> Dim yy As Integer
> Dim zz As Integer

> Set olApp = New Outlook.Application

> SigString = "C:\Documents and Settings\...\Signatures\BillLong.txt"
> If Dir(SigString) = "" Then
> Signature = GetBoiler(SigString)
> Else
> Signature = ""
> End If

> olToName = Range("K5").Value
> olSubject = "Dues Receipt"
> Set olRange = Range("DuesReceipt")

> Set olMail = olApp.CreateItem(olMailItem)
> With olMail
> .To = olToName
> .Subject = olSubject
> .Body = olRange
> .Send
> End With

> Set olMail = Nothing
> Set olApp = Nothing

> End Sub

> > Bill @ UAMS
 
Status
Not open for further replies.
Similar threads
Thread starter Title Forum Replies Date
S Outlook 365 Can I change the possible range of highlighting colours when writing an Outlook email? Using Outlook 1
N Save emails within a certain date range to network drive Outlook VBA and Custom Forms 0
O Export Outlook calendar appointments by filters and date range Outlook VBA and Custom Forms 1
T Search for incoming e-mails for a specified time range Using Outlook 1
K Outlook Archive to PST Files by Date Range VBA Script? Outlook VBA and Custom Forms 1
F Finding Meetings/Tasks in a date range Using Outlook 1
R Calendar Appointment Hour Range Using Outlook 1
J Dynamic date range for Outlook Search folders Using Outlook 2
M Outlook Appointment Item exceeds beyond the date range Using Outlook 2
M Outlook Appointment item does not show the item outside the date range Using Outlook 2
S Printing Selected Date Range in Monthly Style Using Outlook 1
C Duplicate emails from pop but only for certain date range? Using Outlook 4
J Limiting time range dislayed on calender - Outlook 2010 Using Outlook 1
D Print Macro with Page Range? Using Outlook 9
P View emails sent by time range excl weekends Outlook VBA and Custom Forms 1
B Copy Range of Cells from Excel Outlook VBA and Custom Forms 1
T exception when I call ActiveDocument.Range(0,0).Editors.Add(-1) Outlook VBA and Custom Forms 2
V Get selected option in recurrence range group Outlook VBA and Custom Forms 4
U Save messages and attachments for a date range Outlook VBA and Custom Forms 2
J Outlook 2019 Regex email addresses from body Outlook VBA and Custom Forms 6
T 1:1 Datatransfer from incoming mail body to customs form body Outlook VBA and Custom Forms 0
D Copy Appointment Body to Task Body Outlook VBA and Custom Forms 0
Beeto Replace a string in body Outlook VBA and Custom Forms 2
S New Outlook Appointment - Select All Body Text and Change Font and Size Outlook VBA and Custom Forms 1
Z Copy specific email body text Outlook VBA and Custom Forms 0
J How do you disable address search box when typing @ in body of email? Using Outlook 0
F Forward incoming email with 4 embedded images in the body without original sender Outlook VBA and Custom Forms 22
M Autoforward just attachment OR just body. Outlook VBA and Custom Forms 0
G Place jpg in body of email Outlook VBA and Custom Forms 1
D Create new email from the received Email Body with attachment Outlook VBA and Custom Forms 10
G Forward email body to other mail list directly from Exchange server Exchange Server Administration 1
J Implement Keywords based on body message Outlook VBA and Custom Forms 0
D auto forward base on email address in body email Outlook VBA and Custom Forms 0
M White square in body of Outlook Messages (O2016 Version 2012 32bit Click To Run) Using Outlook 4
P Forwarding emails issue with special characters replacing text body Using Outlook 1
witzker Pls help to change the code for inserting date in Ol contact body Outlook VBA and Custom Forms 5
Z Add ComboBox Value to Body of Email Outlook VBA and Custom Forms 1
J Autoreply email recieved from specific sender after deleting some text from body. Using Outlook 0
S Body text of Email from invite date/time Outlook VBA and Custom Forms 7
A How To Get Body of All Emails to view in Blue Using Outlook 1
A How to get body of all emails in outlook 2016 to view in blue color Using Outlook 1
O Forward a email with modified body Automatically. Outlook VBA and Custom Forms 0
B Programmatically force html send and insert clipboard contents into body Outlook VBA and Custom Forms 0
M VBA to auto forward message with new subject and body text Outlook VBA and Custom Forms 8
L dynamic and static dates in Outlook contact "notes" ie. body Using Outlook 2
L Wierd Office 365 Contact unable to edit body of random contacts Using Outlook 5
P Insert link in email body to attached document in Outlook 365 Outlook VBA and Custom Forms 0
W Space in an Outlook appointment body Using Outlook 0
S Custom Form, copy user field data to message body Outlook VBA and Custom Forms 12
J VBA Outlook : Subject line : Cut and Paste name to heading , number to very end of the body of Email Outlook VBA and Custom Forms 1

Similar threads

Top