I am creating a powerpoint presentation for an interactive public display which has an index and clicking on the entry takes you to that specific slide.
I have done this by creating a text frame and then adding an hyperlink to the frame, but for some reason I cannot work out sometimes the links do not work.
Instead I would like to add the hyperlink to the actual text not the frame. I can do this manually but I have 4,500 links to create.
This is the code I use at the moment
Set sh = pp.Slides(1).Shapes.AddShape(Type:=msoShapeRectangle, Left:=leftcm, Top:=topcm, Width:=260, Height:=35)
With sh.ActionSettings(ppMouseClick)
.Action = ppActionHyperlink
.Hyperlink.SubAddress = "73. PowerPoint Presentation"
End With
sh.TextFrame.TextRange.Text = "LEWIS, Arthur John"
I have only tried manually as I cannot work out how to change the code to just add the hyperlink to the text.
Instead I would like to add the hyperlink to the actual text not the frame.
Is this you want?
Sub Add_Hyperlink_to_Text_in_Powerpoint()
Dim sh As PowerPoint.Shape, pp As Presentation
Const leftcm As Single = 0, topcm As Single = 0 'just for test
Set pp = ActivePresentation
Set sh = pp.Slides(1).Shapes.AddShape(Type:=msoShapeRectangle, Left:=leftcm, Top:=topcm, Width:=260, Height:=35)
' With sh.ActionSettings(ppMouseClick)
' .Action = ppActionHyperlink
' .Hyperlink.SubAddress = "73. PowerPoint Presentation"
' End With
sh.TextFrame.TextRange.Text = "LEWIS, Arthur John"
With sh.TextFrame.TextRange.ActionSettings(ppMouseClick)
.Action = ppActionHyperlink
'.Hyperlink.Address = "https://www.google.com"
.Hyperlink.SubAddress = "73. PowerPoint Presentation"
.Hyperlink.TextToDisplay = sh.TextFrame.TextRange.Text
End With
End Sub