PDA

View Full Version : Outlook macro error 4605



ShUz
07-23-2023, 06:56 AM
Hi, this macro is not working in Outlook

30938

Aussiebear
07-23-2023, 12:27 PM
Welcome to VBAX ShUz. Have a look here to see if this helps you get some ideas. https://answers.microsoft.com/en-us/msoffice/forum/all/vba-how-to-change-font-color-etc-in-an-email/67d1201f-806b-e011-8dfc-68b599b31bf5

gmayor
07-24-2023, 12:31 AM
RGB(0, 255, 0) is not actually red colour but, that aside, try the following

Sub Red()
'Graham Mayor - https://www.gmayor.com - Last updated - 24 Jul 2023
Dim olItem As Object
Dim olInsp As Object
Dim wdDoc As Object
Dim oRng As Object

On Error Resume Next
Select Case Outlook.Application.ActiveWindow.Class
Case olInspector
Set olItem = ActiveInspector.currentItem
Case olExplorer
Set olItem = Application.ActiveExplorer.Selection.Item(1)
End Select

With olItem
Set olInsp = .GetInspector
Set wdDoc = olInsp.WordEditor
Set oRng = wdDoc.Application.Selection.Range
oRng.Font.Color = RGB(255, 0, 0)
End With
lbl_Exit:
Set olItem = Nothing
Set olInsp = Nothing
Set wdDoc = Nothing
Set oRng = Nothing
Exit Sub
End Sub