Add the same Hyperlink to multiple Word documents

Hi,

I got a lot of MS Word documents (500+) where I need to add Hyperlinks to the same website to certain words in the text. I have set up a “For Each file in folder” (will have them all in the same folder) followed by “Use Word File - CurrentFile”.
My question is how do I find the specified words (there are 5 different words) and how to add the Hyperlink to these words, through the help of UiPath.

I am new to coding and UiPath, and feel pretty sure this should be fairly easy with the right knowledge.

Thanks for the heplp in advance!

Hello @Michael_dk,
you have this Word Activities Pack where you can append new line with Hyperlink that you want to add to every document.

You can use System.IO.Directory.GetFiles to grab all files in directory which are word format:
System.IO.Directory.GetFiles(“DirectoryPath”,"*.docx").


This will create an array of strings with file path to word documents in specified directory where you have stored your word documents.
With this you can loop over all documents as you requested.

Cheers,
Dino

Hi, @Michael_dk,

you need to install UiPath.Word.Activities dependency for this to work:

You can find example solution on my GitHub Account here:

Cheers,
Dino

Hi Dino,

Thanks for the quick answer and help! Much appreciated.

Do you know if there is a way to add a Hyperlink to a certain word? Like if we say my text in the documents are:
1st document: “… and so with google we can find…”
2nd document: “With the help of google…”
3rd document: “By using google, we…”
And then get the “googles” to be google instead?

I tried with Hyperlinks.Add method (Word), but couldn’t get it to work (can easily just be my poor coding skills). I also tried “Sending Hotkey” without any success.

Again thanks for the help and time you take to help.

br
Michael

Anyone who can help with this? :slight_smile:

Thanks in advance.