Reputation: 2776
I have to know to what slide is making reference each hyperlink. For that I am looking in ActivePresentation.Slides(sliNum).Hyperlinks(linkNum).SubAddress There appears to what slide is making reference the link. Here I put a result of SubAddress: "380,3,dINK the company"
Here what I really need is the number that is between comas (in this case would be 3). The problem comes when I put a new Slide for example before the 3rd slide. Now the slide that I want is the 4th one but the SubAddress doesn't change. I try with ActivePresentation.UpdateLinks and also with shape.LinkFormat.Update and shape.LinkFormat.AutoUpdate but nothing works the SubAddress still continues without changing.
I put the peace of code that I put to find the links reference:
For Each s In ActivePresentation.Slides
For i = 1 To s.Hyperlinks.count
Dim cou As Integer
Dim linkNumber As String
le = Len(s.Hyperlinks(i).SubAddress)
cou = InStr(s.Hyperlinks(i).SubAddress, ",")
linkNumber = Mid(s.Hyperlinks(i).SubAddress, cou + 1, InStrRev(s.Hyperlinks(i).SubAddress, ",") - (cou + 1))
On Resume I need somehow to update the SubAddress or otherwise if someone know another way to know where is reference the hyperlink also will be great. The link types that I am using is msoHyperlinkRange
Upvotes: 2
Views: 2607
Reputation: 14811
When PPT first creates a hyperlink it sets the subaddress to SlideID,SlideIndex,Slide Title
If the slide is later moved, or the slide title changes, that can invalidate the second two bits of information, but the SlideID of a slide never changes, so when in doubt, PPT uses that.
This keeps the links working correctly, at least in PPT, but other programs that (mistakenly) rely on the SlideIndex for linking will run into troubles.
You can learn the current SlideIndex by parsing out the SlideID (as a string) and then:
SlideIndex = ActivePresentation.Slides.FindBySlideID(CLng(sSlideID))
Upvotes: 1