I'd like to change the color of shapes in a visio drawing programmatically...

J

jeff guthlaf

How do i link a shape to a database and depending upon what the value is in
that database, change the color of the shape? (i need to do this for
multiple shapes in the document so do i link the entire drawing and then
either in VBA or the shapesheets, enter code for this.) what would the code
look like? cheers!
 
D

David Parker [Visio MVP]

You can update the formula in the shape.Cells("FillForegnd").Formula cell
with either:
a number from 0 to 23 (or more if you customise the color map)
a valid RGB reference
a valid HSL reference

If you have a grouped shape, then you may need to enumerate through its
sub-shapes too.

You could store your colors in a lookup table, and automatically update the
color of simple shapes using the Database Wizard

Also, if you have Visio Professional 2003, then there is a Color Byy Value
add-on undr Building Plan.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top