More Outlook Resource Sites

Microsoft Developer Network (MSDN)

FAQs and other general resources

forum 24-May-2018 19:50

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.

    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
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
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 ]