Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in RPA by (5.3k points)

I need to change text to hyperlink text in MS Word with a blue prism. I get it working with the code below, but it creates the wrong full path C:\Users\me199ur\Desktop\testfolder\www.test.com

I just need www.test.com

And without the Anchor or not object Anchor (e.g. String) it throws the errorhttps://docs.microsoft.com/en-us/office/vba/api/word.hyperlinks.add

Dim document As Object = GetDocument(handle,document_name) Dim range As Object = document.Range Dim i As Integer range.Find.Forward = True Do While range.Find.Execute(current_text) If True Then range.Text = new_text range.Bold = new_bold range.Hyperlinks.Add (range, "www.test.com") End If i = range.End range.Start = i Loop

1 Answer

0 votes
by (9.5k points)

you should do this :

Add http:// to your hyperlink as in http://www.test.com, when you need to hyperlink a website.

Without http:// or the protocol, any text is considered as an anchor or bookmark within your document.

Related questions

Browse Categories

...