I am using Visio 2002 Pro.
Thanks in advance.
--
From the east coast
Geoff
******************************************************************
Geoffrey Liggins
Senior Research Engineer
C-CORE, Bartlett Building
Memorial University of Newfoundland
St. John's, NF, A1B 3X5, CANADA
office: (709) 737-7579 lab: (709) 737-8470 fax: (709) 737-4706
web site: http://www.c-core.ca
e-mail: Geoff....@c-core.ca
******************************************************************
Sub CountShapesOnPage()
Dim iShapeCount
'Call the shape counting function
iShapeCount = ShapesCount(ActivePage)
'Display the result in a message box
MsgBox "The shape count = " & iShapeCount
End Sub
Function ShapesCount(root As Object) As Integer
'Return value
Dim iCount As Integer
'Shapes collection
Dim shpsObj As Visio.Shapes
'Shape object
Dim shpObj As Visio.Shape
iCount = 0
'Assumes root.Shapes is a group or a page
Set shpsObj = root.Shapes
For Each shpObj In shpsObj
'If the shape is a group, don't count
'it, but do recursively count
'the shapes in the group
If shpObj.Type = visTypeGroup Then
iCount = iCount + ShapesCount(shpObj)
Else
iCount = iCount + 1
End If
Next
ShapesCount = iCount
End Function
Hope that helps,
jacques
"Geoff Liggins" <Geoff....@c-core.ca> wrote in message
news:3CB574A2...@c-core.ca...
Jacque is right, VBA is that way. Here is another example of a VBA macro
that could work for you...
Sub CreateTableOfContents()
' creates a shape for each page in the drawing on the first page of the
drawing
' then adds a hyperlink to each shape so you can click and go to that
page
' define a toc shape
Dim TOCEntry As Visio.Shape
Dim PageToIndex As Visio.Page
' loop through all the pages you have
For Each PageToIndex In Application.ActiveDocument.Pages
' where to put the entry on the page?
Dim X As Integer
' you may want to refine this and use a top down algorithm with
something smaller than 1 inch increments.
X = PageToIndex.Index
' draw a rectangle for each page to hold the text
Set TOCEntry = ActiveDocument.Pages(1).DrawRectangle(1, X, 4, X + 1)
' write the page name in the rectangle
TOCEntry.Text = PageToIndex.Name
' add a hyperlink to point to the page to you can just go there with
a click
Dim hlink As Visio.Hyperlink
' need to create a handle to add the hyperlink
Set hlink = TOCEntry.AddHyperlink
' add a description
hlink.Description = PageToIndex.Name
' add the page name as an address
hlink.SubAddress = PageToIndex.Name
Next
End Sub
Cheers,
--
Zack Moore [MS]
This posting is provided "AS IS" with no warranties, and confers no rights.
"Jacques Laurin" <jlau...@earthlink.net> wrote in message
news:WbXt8.4521$3z3.4...@newsread1.prod.itd.earthlink.net...