ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   how to send a html message from excel (https://www.excelbanter.com/excel-programming/396741-how-send-html-message-excel.html)

Bruce[_2_]

how to send a html message from excel
 
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 = " 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


Ron de Bruin

how to send a html message from excel
 
Hi Bruce

That's the way the function is working Bruce

You can try this
http://support.microsoft.com/default...b;en-us;816644


--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"Bruce" wrote in message ...
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 = " 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



All times are GMT +1. The time now is 05:12 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com