how to send a html message from excel

B

Bruce

I am trying to create a HTML email. When I do it, all of the strings are
trunicated to only include what is showing in the worksheet. If a cell is
narrower then the line of text, it only includes that parts that are
showing.


Here is the code I use to build the message:

Set rng = Sheets("Marketing-letter").Range("A1:A28")


For Each oAccount In OutApp.Session.Accounts
If oAccount.AccountType = olPop3 Then
If oAccount.DisplayName = "(e-mail address removed)" Then
MsgBox "Sending out!"


Dim oMail As Outlook.MailItem
Set oMail = OutApp.CreateItem(olMailItem)
oMail.To = emailname
oMail.CC = ""
oMail.BCC = bbcname
oMail.Subject = "my subject"
oMail.Recipients.ResolveAll
oMail.HTMLBody = RangetoHTML(rng) '& vbNewLine & vbNewLine &
signature
oMail.Attachments.Add ("C:\notary\myattachment.pdf")
oMail.SendUsingAccount = oAccount
oMail.Send

Sheets("Marketing").Select
Range("L" & rowi).Select
ActiveCell.FormulaR1C1 = ActiveCell.FormulaR1C1 & " Sent: " &
Format(Now, "mmm-d-yyyy hh:mm")



'Range("BR29").Select
'.temp_.Select



End If

End If
Next
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top