How to Quickly Extract All URLs from an Outlook Email to a Text File

When receiving an email which contains multiple important URLs in the body, you may want to exact all URLs to a text file. Thus, in this article, we will introduce a method to quickly get it.

Usually, to extract the URLs from an Outlook email to a text file, you have to first create a text file and then manually copy the URLs to the file. You may think it too troublesome and are seeking a more effective means. If so, you can read on. Here we will share an approach to exporting all URLs from an email in batches.

Quickly Extract All URLs in an Email to a Text File

  1. At the outset, in your Outlook, access VBA editor according to “How to Run VBA Code in Your Outlook“.
  2. Then, copy and paste the following VBA code into an unused module.
Sub ExportURLsFromEmail2TextFile ()
    Dim objMail As Outlook.MailItem
    Dim objRegExp As RegExp
    Dim strFolder As String
    Dim objMatchCollection As MatchCollection
    Dim objMatch As Match
    Dim strURL 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
       'Create a new text file
       strTextFile = "E:\Hyperlinks (" & objMail.Subject & ").txt"
       Set objFileSystem = CreateObject("Scripting.FileSystemObject")
       Set objTextFile = objFileSystem.CreateTextFile(strTextFile, True)
       objTextFile.WriteLine ("Extracted URLs:" & vbCrLf & vbCrLf)
       Set objMatchCollection = objRegExp.Execute(objMail.Body)
       i = 0
       For Each objMatch In objMatchCollection
           strURL = objMatch.SubMatches(0)
           i = i + 1
           'Write the URLs to the text file
           objTextFile.WriteLine (i & ". " & strURL & vbCrLf)
       'Open the text file
       Shell ("notepad.exe " & strTextFile)
    End If
End Sub

VBA Code - Extract All URLs in an Email to a Text File

  1. After that, add this macro to Quick Access Toolbar or ribbon.
  2. Finally, take the steps below to have a try.
  • First of all, select or open an email.
  • Then, click the macro button in Quick Access Toolbar or ribbon.Run Macro
  • At once, a new plain text file will be opened, in which you can see all the extracted UTLs, as shown in the following screenshot.Extracted URLs in a Text File

Beware of Risky Links in Email

Every day, you can receive all kinds of emails in your Outlook. Some are from the known contacts, and some may come from the unknown senders. In face of them, you need beware of the unknown emails, some of which may carry the suspicious links. If you open the links, your Outlook file may be infected with viruses. Then, not only will you need to kill the viruses via antivirus software, but also you have to repair the suffering PST file via a potent Outlook repair utility, like 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 SQL Server repair and outlook repair software products. For more information visit

5 responses to “How to Quickly Extract All URLs from an Outlook Email to a Text File”

  1. As you can see, CharmDate advises beginning with standard information concerning on your own. Czech women are a few of the most stunning ladies in Europe, with an impressive figure and facial functions that can turn your head towards the road. The style is as comfy as the desktop computer one, as well as its features are rather helpful. The design of the site is simplistic and also not puzzling. You will certainly love its efficient as well as lovely design. It will certainly increase the rate of your account and also your opportunities to locate a man/woman that fits your expectations. The site helps individuals locate interesting individuals to share tiny talk, along with to build long-term relationships that have all the opportunities to expand till marital relationship. You can read the information to locate safety and security referrals regarding what you must perform in situation of scams. The ideal point is to do it from residence or on the move, in situation you utilize the app.

    CharmDate is the ideal site for you! CharmDate is a preferred site in the international dating market. This function is not distinct and can be found on numerous various other dating internet sites. When you feel, you can do it. Every one of them feel great and have no doubts regarding fulfilling the male of their dreams. You will value having access to a lot of extensive services, as an example, the opportunity to send digital flowers or other adorable presents to those participants you feel a deep connection and also desire to get and also connect to recognize each other much better. Even standard members can send messages to get to know other participants much better and share shared passions. Nevertheless, you ought to recognize that even the very best dating platforms entail privacy threats, suggesting numerous risks due to sharing sensitive personal details with complete strangers. The majority of the participants are motivated to fulfill, connect, and hookup with stunning Russian, Ukrainian, and even Latino girls. CharmDate participants can search by Participant ID or filter the profiles that have actually joined the neighborhood recently, or that are active today to jump to the conversation quickly. However, you can boost your dating experience being a costs member. Everybody can end up being a Costs user.

    The website suggests buying credit histories, which you can use to get access to additional solutions. You obtain accessibility to read/send a single exclusive message. The website clears up further it’s mostly the very best system in the Russian Federation and Ukraine together with the most beautiful and also single women aiming to locate love. Once the brief questionnaire is completed, which aids to tighten the search and also aid the women on-line discover the man of their desires, you then have the opportunity to carry out a much longer more extensive and innovative search later. This info can assist to narrow as well as filter the match search. Depending on your very own strategy, you can select from several feasible means to browse members’ profiles. You should activate the advanced search filters and also browse profiles utilizing the “Smart Matches” attribute provided by the CharmDatesite. After applying as well as turning on all these criteria, users would certainly surf via “Smart Matches” that are suggested by the internet site. Individuals need to specify their match’s favored age, education, hobbies, and extra.

    Also, there are questions regarding your place of living, your lifestyle, hobbies, kind of appearance, and other characteristics that define your external and also internal beauty. Not only can you see what the lady appears like, with generally 2 to 3 various other pictures confined, yet you will certainly also discover out even more regarding her sort, her leisure activities, her marital condition, her needs, what she does for a living, if she has children or wants them, exactly how old she is as well as much more. Nevertheless, you can communicate in 2 different means on Live Chat. We encourage you to attempt communicating with other participants using text or on the internet chat. We motivate you to try the sophisticated search tool if you are not satisfied with the search results. You will certainly want to certainly give it a try if you should be interested in finding really intercourse, friendship or love! The CharmDate dating site has the flowers and presents section where individuals acquire actual presents and flowers to offer to their suits.

  2. I’ve been exploring for a little bit for any high-quality articles or blog posts in this sort of area . Exploring in Yahoo I finally stumbled upon this web site. Reading this information So i am glad to express that I’ve an incredibly good uncanny feeling I came upon just what I needed. I such a lot surely will make certain to do not overlook this website and give it a look on a relentless basis.

  3. Hello
    Just tried this code that I need but got this error: “user defined type not defined” on this line: Dim objRegExp As RegExp
    Can you help ?

Leave a Reply

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