0

I created a macro that will find all months of the year in an email and turn them red. However I only want that to apply to the current email and nothing else within the thread. I'm not sure the syntax I would need to add. Would it be to not check anything below the break line? Or would it have to be a condition based on position?

Can anyone assist?

The following macro needs to add provisions to only apply to the active email I'm writing and no other text below my signature or email break line.

Sub FindAndReplace(findText As String, replaceText As String)
    Dim findText As String 

    Dim replaceText As String

   
ActiveInspector.WordEditor.Application.Selection.Find.ClearFormatting
        ActiveInspector.WordEditor.Application.Selection.Find.Replacement.ClearFormatting      
   ActiveInspector.WordEditor.Application.Selection.Find.Replacement.Font.Color = wdColorRed 

        With ActiveInspector.WordEditor.Application.Selection.Find 

            .Text = findText 
            .Replacement.Text = replaceText 
            .Forward = True 
            .Wrap = wdFindContinue 
            .Format = True 
            .MatchCase = False 
            .MatchWholeWord = False 
            .MatchAllWordForms = False 
            .MatchSoundsLike = False 
            .MatchWildcards = True 

        End With 

        ActiveInspector.WordEditor.Application.Selection.Find.Execute Replace:=wdReplaceAll 

End Sub
braX
  • 11,506
  • 5
  • 20
  • 33
  • See if you can apply any of these ideas, [Copy to Clipboard only the most recent reply in a conversation](https://stackoverflow.com/questions/39300361/copy-to-clipboard-only-the-most-recent-reply-in-a-conversation), [Detect end of new message in email conversation body](https://stackoverflow.com/questions/15768756/detect-end-of-new-message-in-email-conversation-body) and [VBA Detect if an e-mail in editing mode has a signature included?](https://stackoverflow.com/questions/70114895/vba-detect-if-an-e-mail-in-editing-mode-has-a-signature-included). – niton Mar 22 '23 at 14:48
  • None of them worked unfortunately. – churchizactiive Mar 27 '23 at 18:51
  • You could make the question better by showing your attempt(s). – niton Mar 27 '23 at 19:47
  • Another possible approach is to format the text separately in a new mail then to paste that body into the reply. https://stackoverflow.com/questions/27907811/selecting-and-copying-outlook-email-body-with-a-vba-macro and https://stackoverflow.com/questions/54583761/select-the-content-of-word-document-and-paste-it-into-the-body-of-outlook-with-v – niton Mar 27 '23 at 19:49

0 Answers0