Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Visio.Hyperlinks Error -2032465751

120 views
Skip to first unread message

arilou

unread,
Jun 19, 2013, 5:31:28 AM6/19/13
to
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

Paul Herber

unread,
Jun 19, 2013, 5:39:51 AM6/19/13
to
The links are indexed from 0 so make this line:

Set myLink = arLinks.Item(iLink-1)



--
Regards, Paul Herber, Sandrila Ltd.
Electronics for Visio http://www.sandrila.co.uk/visio-electronics/
Electrical for Visio http://www.sandrila.co.uk/visio-electrical/
Electronics Packages for Visio http://www.sandrila.co.uk/visio-electronics-packages/
TTL for Visio http://www.sandrila.co.uk/visio-ttl/
CMOS for Visio http://www.sandrila.co.uk/visio-cmos/

arilou

unread,
Jun 19, 2013, 7:34:46 AM6/19/13
to
Thank you! That solved the problem.

(Even the VBA Debugger shows them starting with 'Item 1' instead of 'Item
0'...)

CU, arilou
0 new messages