Yes, programatic access to Visio is what for me makes it such a powerful
application. If you haven't already you should have alook at the
"ShapeSheet" behind each shape. To view a shape's ShapeSheet (make sure
that the Tools/Options/Advanced/Run in developer mode" is checked) right
click the shape a select "Show ShapeSheet". From here you can view and
change virtually all of the shape's properties (some are only availble from
code). Programatic access is, in simple terms, just a case of reading and
writing to those cells. So your code below would look something like this:
Sub FindMyHelloShape()
Dim pag As Page
Dim shp As Shape
Dim shpNew As Shape
Set pag = Application.ActivePage
For Each shp In pag.Shapes
If shp.CellExistsU("Prop.Resources", 0) = True Then
If shp.Cells("Prop.Resources").ResultStr("") = "Hello World"
Then
'Drop new shape below this one
Set shpNew = pag.Drop(shp.Master, _
shp.Cells("PinX").ResultIU, _
shp.Cells("PinY").ResultIU - 1)
End If
End If
Next shp
End Sub
Pivot Diagrams are slightly more involved but fundamentall work on the same
basis.
So here's a little bedtime reading for you.
The main books are:
"Developing Visio Solutions". Also available online at:
http://msdn2.microsoft.com:80/en-us/library/aa245244(office.10).aspx (see
chapter 18 to get going with Drawing Automation)
"Visualizing Information with Microsoft Office Visio 2007" by David Parker
http://www.visualizinginformation.com (a must if you're serious about Pivot
Diagrams)
Other online resources are:
John Marshalls MVPS site:
http://visio.mvps.org/
Chris Roth's blog:
http://www.visguy.com/
The Visio Insights blog:
http://blogs.msdn.com/visio/default.aspx
plus, of course the SDK (2007 version -
http://www.microsoft.com/downloads/...b8-5ef7-4e6e-a582-c8d6b5ee4e33&displaylang=en)
Hope that helps
Best regards
John
John Goldsmith
www.visualSignals.co.uk