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
 
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
G Retaining Tabs in outlook body Using Outlook 2
S Create Outlook Task from Template and append Body with Email Body Outlook VBA and Custom Forms 4
G Get current open draft message body from VBA Outlook VBA and Custom Forms 1
G Creating Macro to scrape emails from calendar invite body Outlook VBA and Custom Forms 6
H Copying email address(es) in body of email and pasting in To field Outlook VBA and Custom Forms 1
D Delete selected text in outgoing email body Outlook VBA and Custom Forms 0
kburrows Outlook Email Body Text Disappears/Overlaps, Folders Switch Around when You Hover, Excel Opens Randomly and Runs in the Background - Profile Corrupt? Using Outlook 0
K Incorporate selection from combobox into body of email Outlook VBA and Custom Forms 0
C Populate form data into message body Outlook VBA and Custom Forms 1
J Outlook 365 Add keywords from Listbox to the message body where cursor is placed Outlook VBA and Custom Forms 0
Witzker Set Cursor & Focus from any field to the body of a user Contact form in OL 2019 Outlook VBA and Custom Forms 1
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

Similar threads

Back
Top