Update link to slide

G

Gil

Hello,

I have a slide with some rectangles (used as hyperlinks).
I wrote a sub to update these links.
It worked great, but when I added some slides before this slide I got an
error (run time error. The item with the specified name was not found).
I checked and verify that the slide's name remain "Slide 2" (althought I
added some slides before this slide).

How Can I set s point to the same slide (in case the user adds slides
before) ?

Thank you
Gil



Sub updateHyperlinks()

Dim s As Slide
Set s = ActivePresentation.Slides(2)

With s.Shapes("Rectangle 4")
.ActionSettings(ppMouseClick).Hyperlink.Delete
With .ActionSettings(ppMouseClick).Hyperlink
.Address = ""
.SubAddress = "joe report"
.ScreenTip = ""
.TextToDisplay = ""
End With
End With
..
..
..
 
D

David M. Marcovitz

Just because the slide's name is Slide 2, doesn't mean that it is

..Slide(2)

It is now a different slide number. If you know the name of the slide,
then use that, as in:

..Slide("Slide 2")

If you don't know the name of the slide, then you can set it. I think it
is easier in 2007, but in 2003 or earlier, you need code to set the
name. Look for Example 8.7 on my site to get code for getting and
setting slide names:

http://www.PowerfulPowerPoint.com/

Click on "Examples by Chapter" and "Chapter 8."

--David
 

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