0
votes

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 came from VBA Outlook - Replace Paragraph Mark With Manual Line Break.

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?

1

1 Answers

1
votes

Before processing the current item

Set mail = ActiveInspector.CurrentItem