can't programmatically insert a hyperlink on Table Cell of PPT2007

R

Reach Li

After create a table lager than 2*2 in PPT, the following VBA code can insert
a hyperlink in PPT2003 but failed in PPT2007 when set Action:

Sub AddHyperlinkToTableCell()
Dim tr As TextRange
Set tr = ActivePresentation.Slides(1).Shapes(1).Table.Cell(2,
2).Shape.TextFrame.TextRange
tr.ActionSettings(ppMouseClick).Action = ppActionHyperlink
tr.ActionSettings(ppMouseClick).Hyperlink.Address = "c:\test.doc"
tr.ActionSettings(ppMouseClick).Hyperlink.TextToDisplay = "MyHyperlink"
End Sub

The following link http://www.vbforums.com/archive/index.php/t-442549.html
said
"Microsoft has changed the internal code of Powerpoint 12. The old way of
inserting hyperlinks won't work anymore." and provide a solution for common
textrange. But it doesn't work for Table Cell:

Sub AddHyperlinkToTableCell3()
Dim tr As TextRange
Set tr = ActivePresentation.Slides(1).Shapes(1).Table.Cell(2,
2).Shape.TextFrame.TextRange
Set tr = tr.InsertAfter("Hyperlink")
tr.ActionSettings(ppMouseClick).Action = ppActionHyperlink
tr.ActionSettings(ppMouseClick).Hyperlink.Address = "c:\test.doc"
End Sub

Any one can help to add some comments? I am much appreciated for it
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top