How to Open Hyperlink in Outlook Directly instead of New Browser Window

When you click on a hyperlink in an Outlook email, the link will be opened in your default internet browser. But actually you can also use the method introduced in this article to open hyperlink directly in Outlook.

You must have known that when you click on a hyperlink in an Outlook email, the webpage of the link will open by your default Internet Browser. However, there are many users who would like to directly open the hyperlink within Outlook. In the earlier versions of Outlook, there was a visible and obvious web tool. But now, this feature is hidden. Even so, actually, Outlook can still work as a web browser. You can apply the following method which is using Outlook VBA to achieve it in quick time.

Open Hyperlink in Outlook Directly instead of New Browser Window

Open Hyperlink in Outlook Directly instead of New Browser Window

  1. In the first place, launch your Outlook application.
  2. Then press “Alt + F11” key buttons.
  3. Subsequently, you will get into Outlook VBA editor window successfully.
  4. Next copy and paste the following VBA codes into a not-in-use module.
Public Sub OpenHyperlinkswithinOutlook()
    Dim objMail As Outlook.MailItem
    Dim objWordDocument As Word.Document
    Dim objHyperlinks As Word.Hyperlinks
    Dim i As Long
    Dim objHyperlink As Word.Hyperlink
    Dim strHyperlinkList As String
    Dim strNumber As String
    Dim strURL As String
    Dim objExplorer As Explorer
    Dim objWebBrowser As Object
    Dim nAlert As Integer
 
    On Error Resume Next
    Select Case TypeName(Outlook.Application.ActiveWindow)
           Case "Inspector"
                Set objMail = ActiveInspector.CurrentItem
           Case "Explorer"
                Set objMail = ActiveExplorer.Selection.Item(1)
    End Select

    Set objWordDocument = objMail.GetInspector.WordEditor
    Set objHyperlinks = objWordDocument.Hyperlinks
 
    If objHyperlinks.Count < 1 Then
       nAlert = MsgBox("There is no hyperlink in this email!", vbExclamation)
 
       'Get the URL of the only hyperlink
    ElseIf objHyperlinks.Count = 1 Then
       Set objHyperlink = objWordDocument.Hyperlinks.Item(1)
       strURL = objHyperlink.Address
 
       'Select which hyperlink to open
    ElseIf objHyperlinks.Count > 1 Then
       For i = 1 To objHyperlinks.Count
           strHyperlinkList = strHyperlinkList & i & ": " & objHyperlinks.Item(i).Address & vbCrLf
       Next i
 
       For i = 1 To objHyperlinks.Count
           strNumber = InputBox("You have " & objHyperlinks.Count & " hyperlinks in this email as follows. " & vbCrLf & vbCrLf & "Please enter the number to select which one to be opened within your Outlook (format: 1)." & vbCrLf & vbCrLf & strHyperlinkList, "Select Hyperlink")
           Set objHyperlink = objWordDocument.Hyperlinks.Item(strNumber)
           strURL = objHyperlink.Address
           Exit For
       Next i
    End If
 
    'Open the selected hyperlink
    Set objExplorer = Application.ActiveExplorer
    Set objWebBrowser = objExplorer.CommandBars.FindControl(, 1740)

    objWebBrowser.Text = strURL
    objWebBrowser.Execute
End Sub

VBA Codes - Open Hyperlink in Outlook Directly instead of New Browser Window

  1. After that, add the new macro to Quick Access Toolbar or ribbon as usual.
  2. Later change your Outlook macro security level to low.
  3. Finally you can have a try. Firstly, select or open an email and then hit the macro button. Here are 3 cases depending on the total count of hyperlinks in the email.
  • If there is no hyperlink in the email, you will get a warning, shown as the following screenshot:No Hyperlink
  • If there is only one hyperlink in the email, the link will be opened at once, like the image below:Show Webpage in Outlook
  • If there are several hyperlinks in the email, you will be required to select a hyperlink, like the picture below. After you entering the number of the selected hyperlink, the according webpage will be opened at once.Select Hyperlink

Never Fear PST Troubles

Many users will get panic as soon as they encounter unexpected PST corruption. It is because that they haven’t made sufficient precautions, such as the up-to-date PST data backups and an experienced repair tool like DataNumen Outlook Repair. In fact, as long as you keep well-prepared, you won’t need to fear any PST issues.

Author Introduction:

Shirley Zhang is a data recovery expert in DataNumen, Inc., which is the world leader in data recovery technologies, including mdf corruption and outlook repair software products. For more information visit www.datanumen.com

Leave a Reply

Your email address will not be published. Required fields are marked *