Hello,
following quite simple macro shall modify all hyperlinks in the document. But
at
line
Set myLink = arLinks.Item(iLink)
it raises
runtime error -
2032465751 (86db08a9)
Invalid parameter
But I can't see, where I programmed wrong. Google didn't tell much about this
error either.
Sub LinkChanger()
Dim iPage As Integer
Dim arVsoPages As Visio.Pages
Dim page As Visio.page
Dim arShapes As Visio.Shapes
Dim iShape As Integer, iLink As Integer
Dim myShape As Visio.Shape
Dim arLinks As Visio.Hyperlinks
Dim myLink As Visio.Hyperlink
Dim url As String, urlRight As String
Set arVsoPages = ActiveDocument.Pages
For iPage = 1 To arVsoPages.Count
Set page = arVsoPages.Item(iPage)
Set arShapes = page.Shapes
For iShape = 1 To arShapes.Count
Set myShape = arShapes.Item(iShape)
Set arLinks = myShape.Hyperlinks
If arLinks.Count > 0 Then
For iLink = 1 To arLinks.Count
Set myLink = arLinks.Item(iLink)
url = myLink.Address
If Left(url, 2) = "G:" Then
urlRight = Right(url, Len(url) - 2)
url = "H:" & urlRight
myLink.Address = url
End If
Next iLink
End If
Next iShape
Next iPage
End Sub