Hi,
You would have to do the work if you wish to retain the hyperlink, PowerPoint won't do it for you. I would find the text to replaced but check if it contains a hyperlink. If it does then you should be able to read the information and restore it after the
text is replace. The routine below changes all the occurance of the find text with the replace text. I've modified it to check if the text being replace has an actionsetting or not but not the code which does it. You should be able to use the same logic for
ur C# code.
Sub ReplaceTextAndKeepHyperlinks(oShp As Shape, FindString As String, ReplaceString As String)
Dim oTxtRng As TextRange
Dim oFRng As TextRange
Dim oRRng As TextRange
Dim bHasLink As Boolean
If oShp.HasTextFrame Then
If oShp.TextFrame.HasText Then
Set oTxtRng = oShp.TextFrame.TextRange
Set oFRng = oTxtRng.Find(FindWhat:=FindString, WholeWords:=True)
Do While Not oFRng Is Nothing
'Should also check for mouseover action which i am not here.
If Not (oFRng.ActionSettings(ppMouseClick).Action = ppActionMixed Or oFRng.ActionSettings(ppMouseClick).Action = ppActionNone) Then
Debug.Print "Add code to read the actionsetting information"
bHasLink = True
End If
Set oRRng = oTxtRng.Replace(FindWhat:=FindString, _
Replacewhat:=ReplaceString, _
After:=oFRng.Start - 1, _
WholeWords:=True)
If bHasLink Then
Debug.Print "Add code to assign it back to the new textrange"
End If
bHasLink = False
Set oFRng = oTxtRng.Find(FindWhat:=FindString, After:=oRRng.Start + oRRng.Length, _
WholeWords:=True)
Loop
End If
End If
End Sub
Regards, Shyam Pillai. http://skp.mvps.org