How to use Hyperlinks.Add for VSTO in C#?

Hi All,

Does anyone have any examples, or knows how to add a hyperlink to a word in C#? Using the range object?

E.g

 if (Globals.ThisAddIn.Application.ActiveDocument.Paragraphs[1].Range.Find.Execute(ref findWord,
                ref missing, ref missing, ref missing, ref missing, ref missing, ref missing,
                ref missing, ref missing, ref missing, ref missing, ref missing, ref missing,
                ref missing, ref missing))
            {
                MessageBox.Show("Text found.");
              //add hyperlink to the word found

             //   Globals.ThisAddIn.Application.Selection.Hyperlinks.Add(oRange, ref oAddress, ref oMissing, ref oMissing, ref oMissing, ref oMissing);
            }
            else
            {
                MessageBox.Show("The text could not be located.");
            }

Thanks
lp84Asked:
Who is Participating?
 
cyberkiwiConnect With a Mentor Commented:
Give this a try

Globals.ThisAddIn.Application.Selection.Hyperlinks.Add(Globals.ThisAddIn.Application.Selection.Range, ref oAddress, ref oMissing, ref oMissing, ref oMissing, ref oMissing);
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.