How to Quickly Copy All Embedded URLs from One Outlook Email to Another

At times, you may want to copy all the embedded URLs, namely webpage links, in an email to a new email. In this case, you can use the approach introduced in this post.

If you receive an email which is embedded with a great number of website links involving an important project, you may want to forward these URLs to someone else. It’s so troublesome that you copy the URLs to a new email manually. Here is a quick method to realize it with VBA. To run VBA code in Outlook, you can refer to the article – β€œHow to Run VBA Code in Your Outlook”.

Quickly Copy All Embedded URLs from One Outlook Email to Another

Copy All Embedded URLs from One Email to Another

  1. At the very beginning, launch your Outlook program.
  2. Then, access Outlook VBA editor window.
  3. Next, copy and paste the following VBA code into a project or module.
Sub CopyAllHyperlinksFromOneMailToAnother()
    Dim objMail, objNewMail As Outlook.MailItem
    Dim objRegExp As RegExp
    Dim objMatchCollection As MatchCollection
    Dim objMatch As Match
    Dim i As Long
    Dim strURL, strURLs As String
    'Get the source mail
    Select Case Outlook.Application.ActiveWindow.Class
           Case olInspector
                Set objMail = ActiveInspector.CurrentItem
           Case olExplorer
                Set objMail = ActiveExplorer.Selection.Item(1)
    End Select

    'Get URLs using regular expression
    Set objRegExp = New RegExp
    With objRegExp
        .Pattern = "(https?[:]//([0-9a-z=\?:/\.&-^!#$;_])*)"
        .Global = True
        .IgnoreCase = True
    End With

    If objRegExp.test(objMail.Body) Then
       Set objMatchCollection = objRegExp.Execute(objMail.Body)
       i = 0
       For Each objMatch In objMatchCollection
           strURL = objMatch.SubMatches(0)
           strURL = Left(strURL, Len(strURL) - 1)
           i = i + 1
           strURLs = strURLs & i & ". " & strURL & vbCr & vbCr
    End If
    'Input the URL list into a new email
    If Trim(strURLs) <> "" Then
       Set objNewMail = Outlook.Application.CreateItem(olMailItem)
       With objNewMail
           .Body = strURLs
       End With
    End If
End Sub

VBA Code - Copy All Embedded URLs from One Email to Another

  1. After that, add this macro to Quick Access Toolbar.
  2. Finally, you can try this macro.
  • First off, select or open the source email.
  • Then, click on the macro button in Quick Access Toolbar.Run Macro on Selected Email
  • Immediately, when the macro finishes, you will get a new email, in which there is a list of URLs extracted from the source email.
  • It will look like the following screenshot:New Email

Keep Calm In Case of Outlook Corruptions

Many users will become considerably worried as encountering Outlook damage in that they are afraid that their valuable Outlook data will be unrecoverable. As a matter of fact, you can take 3 means to restore your data. At first, you can check if there is an updated data backup. If not, proceed to rescue your damaged Outlook file via Scanpst.exe. Assuming that it fails as well, you can attempt recovery with a powerful external tool, such as DataNumen Outlook Repair.

Author Introduction:

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

Comments are closed.