Find and change highlightcolor in existing mail

I use Outlook 2013 and try to find the yellow selected text in the opened message and change the highlight color.

My eyes are bad and I can’t highlight the highlighted text when the highlight color is yellow. Green is good, Teal is also ... so I want to change it.

I did this in Word 2013.

Sub changer_jaune() 'change_yellow()
  Dim txt_hl As Range
  With Selection.Find
    .Highlight = True
    .Forward = True
    .Wrap = wdFindContinue
    While .Execute
      Set txt_hl = Selection.Range
      If txt_hl.HighlightColorIndex = wdYellow Then
        txt_hl.HighlightColorIndex = wdTeal 'wdTurquoise
        ' dark : wdTeal wdGreen
        ' too dark : wdViolet wdBlue
      End If
    Wend
  End With
End Sub

Then I tried to get it to work in Outlook:

Sub change_jaune_PR_COPIE()
Dim objItem As Object
Dim objInsp As Outlook.Inspector

'Reference the current Outlook item
Set objItem = Application.ActiveInspector.CurrentItem
If Not objItem Is Nothing Then
    If objItem.Class = olMail Then
        Set objInsp = objItem.GetInspector
        If objInsp.EditorType = olEditorWord Then

           'I switch to Edit Mode to be able to change the opened incoming mail
           'I would like to check for this before switching... But I don't know how...
           objInsp.CommandBars.ExecuteMso ("EditMessage")

           Set objDoc = objInsp.WordEditor
           Set objWord = objDoc.Application
           Set objSel = objWord.Selection

     With objWord.Selection.Find
        .Highlight = True
        .Forward = True
        .Wrap = wdFindContinue
        'While .Execute
          Set txt_hl = objWord.Selection.Range
          If txt_hl.HighlightColorIndex = wdYellow Then
            txt_hl.HighlightColorIndex = wdTeal 'wdTurquoise
            ' dark : wdTeal wdGreen
            ' too dard : wdViolet wdBlue
          End If
        'Wend
      End With

        End If
    End If
End If

'Saving the changes on this specific mail (which actually never occurs!!!)
objItem.Save

Set objItem = Nothing
Set objWord = Nothing
Set objSel = Nothing
Set objInsp = Nothing

End Sub

This does not work.

While .Execute

not recognized. He goes to

End With
+4
source share
1 answer

, , . , . , . :

  • , , Outlook
  • : ,

    • Outlook , , ( , , , )
    • , Windows (Windows 7 8), , , ( Windows 98)
      • Windows 8 6 ,
      • , , - Windows Background Button Background, , , . β„– 1 () Windows, RGB 60,60,60 ().

.

  • / , (left)Alt+Shift+PrtScr

  • , High Contrast. . . , , .

    • - , SQL Server Management Studio
    • , , . - , . , upvote/downwote ...

.

  • . . . , , .

, downwote:)

+1

Source: https://habr.com/ru/post/1531636/


All Articles