More Outlook Resource Sites

Microsoft Developer Network (MSDN)

FAQs and other general resources

forum 22-Dec-2014 01:18

Looking for help with Outlook programming projects — VSTO, add-ins, VBA, custom Outlook forms, etc.? You′ve come to the right place!

NEW! >> Subscribe to this site via RSS. For more RSS options, see the complete list of feeds on our main news page.

Login Password
Remember me
Register | Send my password
    Page [ 1 ]  
 Code Essentials Printer Friendly Version
Beginner’s section on how to work in the VBA environment, how to work with functions and expressions – generally not specific to Outlook
Topic
How to Replace Paragraph Marks with Manual Line Breaks
I'm am trying to write some VBA search and replace paragraph marks to manual line breaks in an email I'm composing.

Although I write VBA in Excel, I'm a newcomer to Outlook 2012 VBA.

I'm starting with this code

tmp = Split(mail.HTMLBody, vbCrLf)
For Each Line In tmp
    If Line <> "" Then
        newBody = newBody & Line & vbCrLf
    End If
Next
mail.HTMLBody = newBody

which I found online.

I tried changing "mail" to "item.htmlbody" but I'm getting an "Object Required" error.

Can someone set me on the right path with this?

  20-Feb-2013  10:01
    Page [ 1 ]