Visio.Hyperlinks Error -2032465751

A

arilou

Hello

following quite simple macro shall modify all hyperlinks in the document. Bu
a
lin
Set myLink = arLinks.Item(iLink
it raise
runtime error -2032465751 (86db08a9
Invalid paramete
But I can't see, where I programmed wrong. Google didn't tell much about thi
error either

Sub LinkChanger(
Dim iPage As Intege
Dim arVsoPages As Visio.Page
Dim page As Visio.pag
Dim arShapes As Visio.Shape
Dim iShape As Integer, iLink As Intege
Dim myShape As Visio.Shap
Dim arLinks As Visio.Hyperlink
Dim myLink As Visio.Hyperlin
Dim url As String, urlRight As Strin

Set arVsoPages = ActiveDocument.Page
For iPage = 1 To arVsoPages.Coun
Set page = arVsoPages.Item(iPage
Set arShapes = page.Shape
For iShape = 1 To arShapes.Coun
Set myShape = arShapes.Item(iShape
Set arLinks = myShape.Hyperlink
If arLinks.Count > 0 The
For iLink = 1 To arLinks.Coun
Set myLink = arLinks.Item(iLink
url = myLink.Addres
If Left(url, 2) = "G:" The
urlRight = Right(url, Len(url) - 2
url = "H:" & urlRigh
myLink.Address = ur
End I
Next iLin
End I
Next iShap
Next iPag
End Sub
 
P

Paul Herber

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)

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/
 
A

arilou

arilou wrote on 06/19/2013 05:31 ET
Hello

following quite simple macro shall modify all hyperlinks in the document. Bu
at lin
Set myLink = arLinks.Item(iLink
it raise
runtime error -2032465751 (86db08a9
Invalid paramete
But I can't see, where I programmed wrong. Google didn't tell much about thi
error either

Sub LinkChanger(
Dim iPage As Intege
Dim arVsoPages As Visio.Page
Dim page As Visio.pag
Dim arShapes As Visio.Shape
Dim iShape As Integer, iLink As Intege
Dim myShape As Visio.Shap
Dim arLinks As Visio.Hyperlink
Dim myLink As Visio.Hyperlin
Dim url As String, urlRight As Strin

Set arVsoPages = ActiveDocument.Page
For iPage = 1 To arVsoPages.Coun
Set page = arVsoPages.Item(iPage
Set arShapes = page.Shape
For iShape = 1 To arShapes.Coun
Set myShape = arShapes.Item(iShape
Set arLinks = myShape.Hyperlink
If arLinks.Count > 0 The
For iLink = 1 To arLinks.Coun
Set myLink = arLinks.Item(iLink
url = myLink.Addres
If Left(url, 2) = "G:" The
urlRight = Right(url, Len(url) - 2
url = "H:" & urlRigh
myLink.Address = ur
End I
Next iLin
End I
Next iShap
Next iPag
End Su
Thank you! That solved the problem

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

CU, arilou
 
Top