Results 1 to 10 of 10
  1. #1
    Star Lounger MarkAtHome's Avatar
    Join Date
    Feb 2001
    Location
    New Jersey, USA
    Posts
    85
    Thanks
    1
    Thanked 0 Times in 0 Posts
    I have inadvertently changed the font color of a large email, saved it, and exited.

    The problem is that I have many hyperlinks in that document that are no longer apparent.

    Is there a way to open that email, search for those hyperlinks, and when found, change the text's color to that of normal hyperlink (blue)?

  2. #2
    WS Lounge VIP
    Join Date
    Dec 2009
    Location
    Earth
    Posts
    8,191
    Thanks
    48
    Thanked 984 Times in 914 Posts
    Hyperlinks are often underlined, so that may be a starting point. Failing that I would view the raw email and search for "<a " or "http://". Find the matching text before " </a>" and return to the email and search for the matching text.
    Tell us what mail client you use and we can advise how to view the raw mail.

    cheers, Paul

  3. #3
    Star Lounger MarkAtHome's Avatar
    Join Date
    Feb 2001
    Location
    New Jersey, USA
    Posts
    85
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Hi Paul -- when I changed the font color, I also removed any/all bold/underline/italics, so if you were to view it, it looks like a pure text email, but it isn't.

    I am using Outlook 2010 x86.

    Thanks.

  4. #4
    WS Lounge VIP
    Join Date
    Dec 2009
    Location
    Earth
    Posts
    8,191
    Thanks
    48
    Thanked 984 Times in 914 Posts
    I think (can't test it here 'cause I don't use OL on this machine) if you highlight the entire email (Ctrl A) then right click and select view source, you will be able to see the HTML content.

    cheers, Paul

  5. #5
    Star Lounger MarkAtHome's Avatar
    Join Date
    Feb 2001
    Location
    New Jersey, USA
    Posts
    85
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by P T View Post
    I think (can't test it here 'cause I don't use OL on this machine) if you highlight the entire email (Ctrl A) then right click and select view source, you will be able to see the HTML content.
    Good idea, but there isn't an option to view source viewing an Outlook email. I would surmise, though, that saving the email as an HTML/MHT file would allow me to see that code.

    Unfortunately, there are too many hyperlinks to do this manually.

  6. #6
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts
    Quote Originally Posted by MarkAtHome View Post
    Is there a way to open that email, search for those hyperlinks, and when found, change the text's color to that of normal hyperlink (blue)?
    I developed and tested this in Outlook 2007. Only tried one example, but it seemed to work in this scenario: forward HTML message, select all and choose a color, then run the macro to de-color the links.

    Code:
    Sub StripSpansFromLinks()
    ' Retrieve HTML body for active message
    Dim msg As Outlook.MailItem, strBod As String
    Set msg = ActiveInspector.CurrentItem
    strBod = Replace(msg.HTMLBody, vbCrLf, " ")  ' Convert line breaks to single space
    strBod = WildReplace(strBod, "\s+", " ")  ' Convert all whitespace to single space
    'Debug.Print strBod
    'Stop
    ' Examine links in the HTML body
    Dim lngPos As Long, lngPosEnd As Long, strTemp As String
    lngPos = 1
    Do
        lngPos = InStr(lngPos, strBod, "<a ", vbTextCompare)
        If lngPos = 0 Then Exit Do
        lngPosEnd = InStr(lngPos, strBod, "</a>", vbTextCompare)
        ' Create temp string of the link
        strTemp = Mid(strBod, lngPos, lngPosEnd - lngPos + 4)
        ' Rip out any <span> and </span> tags
        strTemp = WildReplace(strTemp, "<span[^>]*>", "")
        strTemp = WildReplace(strTemp, "</span>", "")
        ' insert modified string back into the body string
        strBod = Left(strBod, lngPos - 1) & strTemp & Mid(strBod, lngPosEnd + 4)
        lngPos = lngPos + 3
    Loop
    'Debug.Print strBod
    'Stop
    ' Rewrite the HTML body
    msg.HTMLBody = strBod
    Set msg = Nothing
    End Sub
    
    Private Function WildReplace(strExpression As String, strFind As String, _
        strReplace As String, Optional bolReplaceAll As Boolean = True, _
        Optional bolCaseSensitive As Boolean = False) As String
      If (strExpression = vbNullString) Or (strFind = vbNullString) Then
        WildReplace = strExpression
        Exit Function
      End If
    
      Dim objregexp As Object
      'instantiate regexp object
      Set objregexp = CreateObject("vbscript.regexp")
      objregexp.IgnoreCase = Not bolCaseSensitive
      objregexp.Global = bolReplaceAll
      ' Pattern syntax: Visual Basic Scripting Edition-Pattern Property
      objregexp.Pattern = strFind
      
      'outer lines temporarily replace the line feeds to avoid the wildcard search tripping on them
      strExpression = Replace(strExpression, vbCrLf, "zxzx")
        strExpression = objregexp.Replace(strExpression, strReplace)
      WildReplace = Replace(strExpression, "zxzx", vbCrLf)
      
      Set objregexp = Nothing
    End Function

  7. #7
    Star Lounger MarkAtHome's Avatar
    Join Date
    Feb 2001
    Location
    New Jersey, USA
    Posts
    85
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by jscher2000 View Post
    I developed and tested this in Outlook 2007. Only tried one example, but it seemed to work in this scenario: forward HTML message, select all and choose a color, then run the macro to de-color the links.
    Thanks, jscher2000. Will give it a try during the week and let you know how I made out. Appreciate it.

    One thought, though. What do I get by forwarding the email, instead of simply editting it? The email was saved and is in the Drafts folder.

  8. #8
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts
    Quote Originally Posted by MarkAtHome View Post
    What do I get by forwarding the email, instead of simply editting it? The email was saved and is in the Drafts folder.
    I just needed something to work with. I don't usually compose lengthy HTML messages.

  9. #9
    Star Lounger MarkAtHome's Avatar
    Join Date
    Feb 2001
    Location
    New Jersey, USA
    Posts
    85
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by jscher2000 View Post
    I just needed something to work with. I don't usually compose lengthy HTML messages.
    Ah. So I need not do a forward. Gotcha, and thanks.

  10. #10
    Star Lounger
    Join Date
    Dec 2009
    Location
    Lansing, MI
    Posts
    65
    Thanks
    1
    Thanked 2 Times in 2 Posts
    This would work to get you back to the original text color with the formatted hyperlinks (in Outlook 2007, so I'm guessing it might be the same in 2010), but you will lose the formatting you applied through out the email. So it may not work for what you need if you are concerned about changing everything back to where it started sans-formatting.

    Highlight all the text, go to the Format Text tab, Click on Quick Styles and choose Clear Formatting.

Posting Permissions

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