Consulting

Results 1 to 3 of 3

Thread: Outlook macro error 4605

  1. #1
    VBAX Newbie
    Joined
    Jul 2023
    Posts
    1
    Location

    Outlook macro error 4605

    Hi, this macro is not working in Outlook

    4605.jpg

  2. #2
    Moderator VBAX Wizard Aussiebear's Avatar
    Joined
    Dec 2005
    Location
    Queensland
    Posts
    5,059
    Location
    Welcome to VBAX ShUz. Have a look here to see if this helps you get some ideas. https://answers.microsoft.com/en-us/...c-68b599b31bf5
    Remember To Do the Following....
    Use [Code].... [/Code] tags when posting code to the thread.
    Mark your thread as Solved if satisfied by using the Thread Tools options.
    If posting the same issue to another forum please show the link

  3. #3
    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
    Graham Mayor - MS MVP (Word) 2002-2019
    Visit my web site for more programming tips and ready made processes
    http://www.gmayor.com

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •