Add shapes and change their color at the same time through VBA


    Sponsored Links


  • 1. Cant switch to RunMode with visio2003 drawing control
    hi im having a little problem with the visio 2003 activeX drawing control, I have a document with OLE combo box ,in visio application it works fine, i can change the document mode from design mode to run mode and the checkbox act as expected. but when the drawing control loads the document its a different story - after setting the document mode to visDocModeRun : 1. the RunModeEntered event fires. 2. the mode proprty returns visDocModeRun. but the checkbox itself(like all the uther ole objects) still act like its on design mode. i'v tried to run the drawing control with delphi6, and with VB6. please Help.
  • 2. Unable to Open Word in MS Office 2000 with Error Message
    I am unable to open any word documents all of a sudden that I made with the word templste of my MS Office 2000. I have a few ideas of what might be going on here since it seems to be referring to a driver used by my Lexmark printer but the two have co habitated nicely before so I'm at a lose as what to do now. I am looking for some knowledgeable feedback. The error message I am getting is: WINWORD caused an invalid page fault in module WWLXSY.DRV at 0003:000011d9. Registers: EAX=40070089 CS=4007 EIP=000011d9 EFLGS=00000206 EBX=00000000 SS=41f7 ESP=00009e68 EBP=00009e76 ECX=00000002 DS=3fcf ESI=00000000 FS=0000 EDX=00000000 ES=41ff EDI=00000000 GS=0000 Bytes at CS:EIP: 66 26 83 bf 80 00 03 77 0f 66 26 8b 87 80 00 c4 Stack dump: 469348bf 00010000 01740000 9ec0400f 800a00e5 400f0000 41ef0000 41ff0000 3fcf4698 12e23fcf 654c1302 72616d78 3233206b 53203030 65697265 6f432073
  • 3. visio add-on
    Download the v2003 sdk, it has several examples Al "Alejandro" < XXXX@XXXXX.COM > wrote in message news: XXXX@XXXXX.COM ... > Heeeeeeelllllllllppppppp...... > > How can i create a visio add-on whit visual basic .net or c#??
  • 4. How to change to connector tool by code?
    How can I change cursor method to connector tool from selection tool and v.v. by code? PLZ help
  • 5. Visio 2000 Startup with specific template
    Hi All! I would like to make Visio 2000 start up with a specific template that I have created. I have tried to place it in the startup folder, but that didn't work. I have read in the help that I need to create a macro and place it in this dir. However, I don't know how to create a macro without creating a vss-file. Could somone please tell me step by step how I make Visio 2000 do what I want :-) Thanks in advance!

Add shapes and change their color at the same time through VBA

Postby consulttech2004 » Sat, 19 Jan 2008 05:24:09 GMT

I want to use the ShapeAdded event so that when I add a shape from an
electrical stencil, the shape turns red (or green, or blue, or
whatever) so that it stands out from the rest of my drawing.  Any
ideas on how to do this consistantly through VBA?  Thanks in advance.

(VISIO Newbie)

Re: Add shapes and change their color at the same time through VBA

Postby John Goldsmith » Sat, 19 Jan 2008 06:31:01 GMT

Hello David,

For events, checkout this link:

 http://www.**--****.com/ (office.10).aspx (DVS - 
Handling Visio Events)

For the change of fill colour, you can use the macro recorder (Tools / Macro 
/ Record new macro...) to record the code as you make the changes manually 
in the UI, which you can then integrate into you final solution.

Are you sure, by the way, that you can't achieve what you're after just 
using the ShapeSheet?  On what basis do you want the colour to change?

Best regards


John Goldsmith

Similar Threads:

1.Changing color of shape with VBA code...

I would like to change the color of a shape with VBA code.  How can this be 
done?  code examples?

In the long run i would like to be able to do this using data from a 
database, controlled by the VBA code.  Thanks!

2.Change color of shape

I'm aware about reports that the Visio 2003 .NET/C# SDK will be
released somewhere Q1-2004. However I'm hoping that somebody can give
me a hint beforehand how to achieve to change the color of a shape

I got it working to find the selected Visio shape. And I can change
the text, however I don't have the slightest idea how to change the
color of the shape.

Maybe through SetFormula() but I don't understand what the arguments

//this works:
this.selectedShape.Text = visio_term + " exists";

//but what is SRCStream and formulaArray?
this.selectedShape.SetFormulas(ref SRCStream, ref formulaArray, 0);

The documentation does not reveal more then

public abstract new System.Int16 SetFormulas ( System.Array
SRCStream , System.Array formulaArray , System.Int16 Flags )
Member of Microsoft.Office.Interop.Visio.IVShape

Any one has a clue?


3.Change fill color of shape through code

I have been making my own master shapes.  I note that I can change the
fill color of some master shapes through code using the following

Shape.FillStyle = "red"

Or whatever I have defined my style to be.  It works pretty well for
our purposes.  The problem is that some master shapes don't seem to
have a fill color, and some that I have drawn (all of them, in fact)
don't seem to want to change color through VBA no matter what I do.
Is there something I'm missing?  Thanks in advance,


4.Change shape background color on a visio stencil


does somebody know how to change the background color of a shape already 
inserted to a stencil?

The problem is that I have to use a transparent image. When I drop it to the 
stencil, the background is transparent and the image quality is really bad 
(unrecognizable). If the background color of the image is white, the icon has 
a good quality and is recognizable.

Thanks, udo

5.How to Change Color of a Group of Shapes

Hi, Gurus,

I have a Visio program.   I created a group of line shapes.  I want to 
change the colors of all lines when a specific data goes beyond the range, 
say, if value > 1000.  How can I do that by using the group properties with 

Thanks so much in advance.


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

7. Excel VBA - Add Sheet Change Event at Run Time

8. change font color of tasks or color of bars from VBA

Return to VISIO


Who is online

Users browsing this forum: No registered users and 57 guest