HEY guys,
I'd like to name a shape (in developer ribbon) with an individual letter combination and the number of the page it is linked to.
So e.g.: if the shape is linked to another shape at page 30 of foregrounds, its name should be A30.
Need your brains :D
I don't know enough vba codes or orders to get the solution by myself :-[
Hope it is easier for you!
Hi !
what you mean as linked page ? Hyperlink sub-address to some page ?
Hello Surrogate,
yes, exactly. A hyperlink with subadress to another page :)
I'm sure this must be possible anyway, but don't have the experience in VBA with Visio :/
Please try this code !
Sub For_Breital()
Dim shp As Shape, sa As String, dp As Integer
For Each shp In ActivePage.Shapes
' check is shape have hyperlinks
If shp.SectionExists(visSectionHyperlink, visExistsAnywhere) Then
' check is shape's hyperlink have sub-address
If Len(shp.Hyperlinks(0).SubAddress) > 0 Then
' check is sub-address have shape's name
If InStr(shp.Hyperlinks(0).SubAddress, "/") > 0 Then
' split pagename in sub-address
sa = Left(shp.Hyperlinks(0).SubAddress, InStr(shp.Hyperlinks(0).SubAddress, "/") - 1)
Else
sa = shp.Hyperlinks(0).SubAddress
End If
' rename shape
shp.Name = sa
End If
End If
Next
End Sub