We help IT Professionals succeed at work.

Modify hyperlink in Outlook to new mapped drive?

Medium Priority
Last Modified: 2012-05-06
Is there a software, macro, or process to change hyperlink locations from email source in Outlook 2003?
We have recently had some reorganization of mapped drives. Our legal department have emails with hyperlinks referencing the old map drive letter, and the hyperlinks in the email are aliased, so I can't use LBE Find and Replace to search for file:///F and change the F drive letter to P.
Thanks for any information you can provide.
Watch Question

Top Expert 2010

Hi, TechNovice-75.

I might be able to help, but I need to understand what you mean when you say, "the hyperlinks in the email are aliased".  


For example, in the email the hyperlink would display Plaintiff's Request for September dates, invisible to the reader of the location on the network where the file was located, unless they get the balloon when they hover over the link. That is what I meant by alias.
My first thought was, if there was a solution, it would be easy to change a hyperlink in the email if it was dispalyed as file:///F\[i]filename[/i]: or F:\filename, using a find and replace any instance of F: with P:
I right-clicked on the email to view source, but I'm not sure if this is the area to make the changes.
Top Expert 2010

Got it.  Then a simple search and replace ought to work.  Are all the messages in HTML format?


Yes, they are in HTML format.
Top Expert 2010
Ok.  Let's try this.  This code will replace all instances of "f:" with "p:" in all selected messages.  Follow these instructions to use this.

1.  Start Outlook
2.  Click Tools > Macro > Visual Basic Editor
3.  If not already expanded, expand Microsoft Office Outlook Objects and click on Module1
4.  Copy the code from the Code Snippet box and paste it into the right-hand pane of Outlook's VB Editor window
5.  Edit the code as needed.  I included comments wherever something needs to or can change
6.  Click the diskette icon on the toolbar to save the changes
7.  Close the VB Editor
8.  Make a copy of one of the messages you'd like to fix.
9.  Select the copy
10.  Run the macro
11.  Verify that the message was updated correctly

If this works the way you want it to, then I recommend making a backup copy of all the messages you want to process, then select and process the originals.  Keep in mind that this macro is going to repalce all instaces of f: without regard to where they occur in the message (i.e. not just in hyperlink URLs).
Sub FixHyperlinks()
    Dim olkMsg As Outlook.MailItem
    For Each olkMsg In Outlook.Application.ActiveExplorer.Selection()
        olkMsg.HTMLBody = Replace(LCase(olkMsg.HTMLBody), "f:", "p:")
    Set olkMsg = Nothing
End Sub

Open in new window

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts


It works like a charm. Thank you for all your help.
Top Expert 2010

Thanks, and you 're welcome.  Glad I could help.
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.