Hi Vino,
A lot of the ShapeSheet cells that control the formatting of these shapes
are guarded. The ShapeSheet is an Excel-like spreadsheet behind every shape
that holds properties and data.
You'll notice that if you right-click a lot of the shapes, there are
options, such as "Enable" or "Disable". When you disable an
xp-control-shape, the shape turns gray. This is due to smart formulas in the
ShapeSheet. In order to guarantee this behavior, the designers had to
lock-down control of the formatting. On one hand the shapes are cool,
because of the extra features, but on the other hand, you lose some
flexibility.
There's a trick that allows you to "dummify" the shapes. Size your shape to
your liking, add text, then copy it. Now paste special via Edit > Paste
Special, and choose "metafile" or "picture". Select the object that gets
pasted, and ungroup it (Ctrl + Shift + U) This will give you raw shapes that
you can freely format. All the smart behavior will be gone however, and
sometimes gradient fills get broken into thin strips, which is annoying.
Last trick: some of the formatting can be freed up by setting the LockFormat
cell in the Protection section to 0 (or go to the Format > Protection
dialog) Since the UI shapes can consist of shapes within groups within
groups, this can be tedious, so you can run this VBA script against all
selected shapes:
------------------------
Sub UnlockFormat()
Dim shp As Visio.Shape
For Each shp In Visio.ActiveWindow.Selection
Call m_unlockFormat(shp)
Next
End Sub
Private Sub m_unlockFormat(shp As Visio.Shape)
If shp.CellsU("LockFormat").ResultIU <> 0 Then
shp.CellsU("LockFormat").ResultIU = 0
End If
If shp.Shapes.Count > 0 Then
Dim shpSub As Visio.Shape
For Each shpSub In shp.Shapes
Call m_unlockFormat(shpSub)
Next
End If
End Sub
------------------------
--
Hope this helps,
Chris Roth
Visio MVP
Free Visio shapes:
http://www.visguy.com/category/shapes
Visio programming info:
http://www.visguy.com/category/programming/
Other Visio resources:
http://www.visguy.com/visio-links/