Quote Originally Posted by gmayor View Post
I have not attempted to debug your code, however the following macro will replace line breaks with paragraph breaks in the current message. You can display the line breaks with CTRL+SHIFT+*
Option Explicit
Private Sub ReplaceLineBreaks(ByVal objItem As MailItem)
Dim objInsp As Outlook.Inspector
Dim objWord As Object
Dim objDoc As Object
Dim objRng As Object

    ' Reference to Word library
    ' in VBA Editor, Tools, References (not required)

    'Reference the current Outlook item
    With objItem
        If .Class = olMail Then
            Set objInsp = objItem.GetInspector
            Set objDoc = objInsp.WordEditor
            Set objRng = objDoc.Range
            .Display
            With objRng.Find
                Do While .Execute(FindText:="^l")
                    objRng = vbCr
                    objRng.collapse 0
                Loop
            End With
        End If
    End With
End Sub
Open a message and test the macro with the following:
Sub test()
ReplaceLineBreaks ActiveInspector.CurrentItem
End Sub
It is not clear what your problem is, but this should remove replace all line breaks in the message.

Thank you Graham. I'm looking to replace ALL of the ^p (Word Paragraphs) with ^l (I believe Word br ) in Outlook automaticall when I hit "send". The macro I posted does this but it also does:

  • Indent 1 bullet
    • Indent 2 Bullet
      • Indent 3 Bullet




  1. Numbering 1
  2. Numbering 2
    1. Numbering 3 indent 2
      1. Numbering 4 indent 3



After running macro
Indent 1 bullet
Indent 2 Bullet
Indent 3 Bullet
Numbering 1
Numbering 2
Numbering 3 indent 2
Numbering 4 indent 3

I'm not sure why it removes the indentions as well as replacing the ^p with ^l.

I hope this makes more sense. This is my first endeavor to implement a VBA macro in Outlook. I thought simply automating a "replace all" would do it, but it makes a mess out of my outlines, as does the manual "replace all".

I will try to change your macro to the following, but I'm not sure how to activate it yet.
With objRng.Find
Do While .Execute(FindText:="^p")
objRng = "^l"
objRng.collapse 0
Loop

Thanks,
Ken