oompa_l was wondering how to set the Height formula for a bunch of shapes over in this thread:
http://visguy.com/vgforum/index.php?topic=47.0I'll talk about two ways of going about this right now.
Are the shapes all instances of the same master?If so, then do this:
1.
File > Shapes > Show Document Stencil to see the local stencil, which contains masters used in the document
2. Double-click the master icon
3. Edit the formula
This will change the formula in all the instances in all of the pages in the document --
unless -- you've already overridden formulas in individual shapes.
Write a macroLike Cyndi Lauper sang,
Coders just want to have fun. We can always get more done, more quickly (and cause more trouble) with VBA. So let's have at it:
'// Get a bunch of selected shapes
Dim sel as Visio.Selection
Set sel = Visio.ActiveWindow.Selection
'// 'Do' each shape in the selection:
Dim shp as Visio.Shape
For Each shp in sel
'// Note: here are several examples that you can
'// comment-out and uncomment
'// Set the value in inches:
shp.Cells("Width").ResultIU = 2.0
'//...or set the value in centimeters:
'shp.Cells("Width").Result(Visio.visUnitCodes.visCentimeters) = 50.8
'//...or set the formula
'shp.Cells("Width").Formula = "GUARD(Prop.Row_1)"
'//...or override a cell that already has a GUARDed formula:
'shp.Cells("Width").FormulaForce = "GUARD(Prop.Row_1)"
'// You can get at cells with indices as well:
'shp.CellsSRC(Visio.VisSectionIndices.visSectionObject, _
' Visio.VisRowIndices.visRowXFormOut, _
' Visio.VisCellIndices.visXFormWidth).Result = 3.0
'// Put the cursor in a ShapeSheet cell, then hit F1 to get the
'// Section, Row, Column indices for a cell.
Next shp