AddLink()

I'm not having much luck with these links. I'm trying to add a link that doesn't already exist to a TextFrame.Paragraph.Portion. It seems I can add a link to a textframe or a shape, but not a section of a textframe. Please advise...

Thank you,

Chad Baker.

Dear Chad,

This code add new Rectangle with “Hello world” text to a slide and add link to “world”:

Slide slide = … ;

Rectangle rect = slide.Shapes.AddRectangle(1000, 1000, 2000, 500);
rect.AddTextFrame();

TextFrame tf = rect.TextFrame;
if (tf != null) {
tf.Links.Clear();
Link link = tf.Links.AddLink();
link.SetExternalHyperlink(“http://www.wikipedia.org”);
link.Begin = 6; // ‘w’ character
link.End = 11; // end of text
}