cancel
Showing results for 
Search instead for 
Did you mean: 

MS Word Hyperlink Extraction

KhushbooKumari
Level 2
Hello Team,

Request you to advise how to extract hyperlink from MS Word file.

Thanks & Regards
Khushboo Kumari

------------------------------
Khushboo Kumari
Junior Configurator
HSBC
Asia/Kolkata
------------------------------
1 REPLY 1

Hi Khushboo,

For your given use case, you can extend the MS Word VBO by creating your own custom action as shown in the solution below:

Solution Walkthrough:

In order to achieve this, we can extend the "MS Word VBO" by creating a separate action within it and you can call it as "Get Hyperlinks". This action will be having the following input parameters:

  1. handle (Number) : The data item having the handle value in the instance dictionary that needs to be queried. (This you can get from Create Instance action)

  2. document Name (Text) : The document name of the current workbook which the Blur Prism bot is operating on. (This you can get from Open Workbook action)

This action will also have an output parameter called 'Hyperlinks' which is of Collection type which will consist of all the extracted hyperlinks from the supplied word document.

Refer to the below workflow for more information:

20518.png
Input Parameters:

20519.png
Output Parameters:

20520.png


Now, add a custom code stage with the following Input & output parameters and the code as shown below:

20521.png
20522.png

Code:

Dim wDoc As Object = GetDocument(handle,document_name)
Dim i As Integer
Dim dt As New System.Data.DataTable
Dim dr As System.Data.DataRow

dt.Columns.Add("Hyperlink", GetType(String))

For i = 1 To wDoc.Hyperlinks.Count Step 1

            dr = dt.NewRow
            dr("Hyperlink") = wDoc.Hyperlinks(i).Address
            dt.Rows.Add(dr)

Next

Hyperlinks = dt



You can publish this action and run the same from Process Studio to check your results.

Some of the test results are shown below:


Scenario: I have added two hyperlinks in my word document for Google and Linkedin:

20523.png

20524.png

Result of the action is:

20525.png

Let us know if this helps you and also if you have any queries feel free to reach us out!

------------------------------
----------------------------------
Hope it helps you and if it resolves you query please mark it as the best answer so that others having the same problem can track the answer easily

Regards,
Devneet Mohanty
Intelligent Process Automation Consultant
Blue Prism 7x Certified Professional
Website: https://devneet.github.io/
Email: devneetmohanty07@gmail.com

----------------------------------
------------------------------
---------------------------------------------------------------------------------------------------------------------------------------
Hope this helps you out and if so, please mark the current thread as the 'Answer', so others can refer to the same for reference in future.
Regards,
Devneet Mohanty,
SS&C Blueprism Community MVP 2024,
Automation Architect,
Wonderbotz India Pvt. Ltd.