When viewing an Outlook email which contains a lot of hyperlinks in body, at times, you may only wish to quickly open the hyperlinks with a specific domain. Here we’ll share a method to open such hyperlinks in bulk.
In face of multiple hyperlinks in one email, you may hope to check some of them, instead of all. For example, you only would like to batch open the hyperlinks with a specific domain. In general, you have to click one by one to open them. It is very troublesome. Therefore, in the followings, we’ll teach you a more convenient way.
Batch Open All Hyperlinks with a Specific Domain in Email
- For a start, access Outlook VBA editor according to “How to Run VBA Code in Your Outlook“.
- Subsequently, in the “Microsoft Visual Basic for Applications” window, enable the reference to “MS Word Object Library” with reference to “How to Add an Object Library Reference in VBA“.
- Then, copy the following VBA code into an unused module or project.
Sub BatchOpenHyperlinksWithSpecificDomain() Dim objMail As MailItem Dim objMailDocument As Word.Document Dim objHyperlink As Word.Hyperlink Dim objDictionary As Object Dim i As Integer Dim varHyperlinks As Variant Dim varHyperlink As Variant Dim objInternetExplorer As Object 'Get the source email Select Case Outlook.Application.ActiveWindow.Class Case olInspector Set objMail = ActiveInspector.CurrentItem Case olExplorer Set objMail = ActiveExplorer.Selection.Item(1) End Select Set objDictionary = CreateObject("Scripting.Dictionary") Set objMailDocument = objMail.GetInspector.WordEditor For Each objHyperlink In objMailDocument.Hyperlinks If InStr(1, objHyperlink.Address, "www.datanumen.com") > 0 Then 'Add Hyperlinks to Dictionary If objDictionary.Exists(objHyperlink.Address) = False Then objDictionary.Add objHyperlink.Address, 1 End If End If Next 'Batch Open Hyperlinks on different tabs in same Internet Explorer window Set objInternetExplorer = CreateObject("InternetExplorer.Application") varHyperlinks = objDictionary.Keys For i = LBound(varHyperlinks) To UBound(varHyperlinks) varHyperlink = varHyperlinks(i) If i = 0 Then objInternetExplorer.Visible = True objInternetExplorer.navigate varHyperlink Else objInternetExplorer.navigate varHyperlink, CLng(2048) End If Next End Sub
- Next, add this macro to Quick Access Toolbar or ribbon.
- Finally, take the following steps to have a try.
- First off, select or open an Outlook email.
- Then, click the macro button.
- At once, the hyperlinks with the predefined domain in the email will be batch opened in the Internet Explorer, as shown in the following image:
Get Rid of Irritating Outlook Corruption
Although Outlook is susceptible to errors and corruption, actually, as long as you look out for all risks, you can escape from them with ease. For instance, you need to make data backups for Outlook on a regular basis. Besides, you ought to watch out for the suspicious emails which may contain viruses. Last but not least, you’d better prepare an Outlook repair utility, such as DataNumen Outlook Repair. It is capable of helping you in the event of Outlook corruption.
Author Introduction:
Shirley Zhang is a data recovery expert in DataNumen, Inc., which is the world leader in data recovery technologies, including corrupt SQL Server and outlook repair software products. For more information visit www.datanumen.com