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


    Sponsored Links


  • 1. Hyperlink to a .mov file after saving as web page
    I create emergency pre-plans in visio pro 2003 and link many areas to .jpg files and or .mov files (Quicktime). Obviously, the links do not function after saving the file as a web page. Does anyone have an idea on how I may accomplish this? thanks so much, -- Keith -- Keith
  • 2. Erratic custom properties
    Hi All, Two apparently related problems when I use custom properties in custom stencils with custom templates and property sets (taking into account the settings related to master and document stencils): 1) Using custom properties result in unpredictable behavior - the custom properties of the instance does not correspond to that of the stencel (both with master or document stencils) 2) From time to time when I save a file and re-open it, the custom properties seem to have gone to MS heaven - properties and values gone. Appreciate any assistance albert
  • 3. How to convert Visio flowchart to Excel or Word
    Hi All This is my first time using Visio and also this forum, please pardon me if I do anything wrongly. My question is: i have a flowchart left over by my ex collgue now I need to convert to excel or word for modification, anyone can help please. Thank you Regards, Richard tan
  • 4. How can I get Visio 5.0 to be compatible with XP?
    I keep getting the message that Visio 5.0 in not compatible with XP, is there an update I can download to make it work?
  • 5. Issue When Opening File
    I have created a process document with about 9 pages. When I open it up now (did not always happen) a box pops up asking how many lanes I want in my swimlane/functional flowchart as though I had just inserted a new page and asked for that format. Once I hit cancel it goes away at the stencil(s) load. Any idea why this is happening and how to stop? Thanks.

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

Postby jeff guthlaf » Sun, 19 Jun 2005 00:52:35 GMT

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!

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

Postby David Parker [Visio MVP] » Sun, 19 Jun 2005 04:03:37 GMT

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.

Similar Threads:

1.Shape changes color when dropped on drawing

When I open an existing diagram all of the 2003 shapes (User, ethernet, & 
Server)are grey when they should be colored.
When I drag it from the stencil and drop it on the drawing it turns grey 
like all of the existing shapes in the drawing.  This only happens on the 
existing file.  If I close the file and open a new blank drawing and drop the 
user shape on it, it works fine. 

I found that it I copy the drawing (Cntrl-A), close the drawing and open a 
new blank drawing and past it in they are still all grey.If I do the same 
thing but place one shape on the drawing first and then past the drawing on, 
all of the same typ of shapes have the correct color.

Is there some type of preference or setting in the drawing that is doing this.

2.Shape changes color in drawing

In one of my diagrams all of the shapes are grey instead of the normal color. 
(as an example, the user shape should be blue but it is grey in the drawing.)
When I drag a new shape on the drawing from a stencil it changes from blue 
to grey.

If I open a blank drawing and place a user in it first and the past the 
drawing in from the clipboard then all of the users are correct.

it appears to be something in the drawing properties.

Is there a way to refresh all of the objects in the drawing to have them 
take on their default color?
What setting in the drawing could be causing this?


3.Changing color of object in vision drawing based on an alert

We use a combination of products to perform autodiscovery (LANSurvey) and 
converting the discovered information into a Visio drawing (LanSurvey for 
Visio).  I would like to hook up the alert feature of LANSurvey to change the 
color of an object (or get the object blinking, or any other visual cue) in 
the Visio drawing when an alert against a device occirs.  
Can anyone help? 

4.Changing color in each tabbed drawing


How do you change the color of each drawing in Microsoft Viso.  I have multiple tabs and when you go to change the color, it changes the colors in each tab the same as the first



5.drawing a shape programmatically

Hi everyone,

I have a problem with drawing a shape dynamically at run time. I want to
have a rectangle which has many lines drawn dynamically inside it (like a
table). So, I have code like this:

Dim shp1obj As Visio.Shape
Set shp1obj = ActivePage.DrawRectangle(0, 0, 1, 1.5)

Now, when I try to call shp1obj.DrawLine method, it complains that the
method is not supported.

How can I draw lines and add text dynamically to a shape. What I am trying
to do is implement a table like shape in Visio.


6. Change Background color of Text Blocks in Org Chart Shapes -visio

7. How to change Visio Shape color with vb???

8. Change shape background color on a visio stencil

Return to VISIO


Who is online

Users browsing this forum: No registered users and 49 guest