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

VISIO

    Sponsored Links

    Next

  • 1. Dynamic connector thickness
    Hi, I am using visio(2003) drawing control on C#(VS.NET 2005). I have some shapes on drawing control which i am connecting using connectors by using this statement on button click event: SendCommand(Microsoft.Office.Interop.Visio.VisUICmds.visCmdDRConnectorTool); But now i want the connectors with more thickness then the default thickness. Please tell me how to achieve this programattically. Thanks in Advance. Manish Gupta XXXX@XXXXX.COM
  • 2. Adding references from network path causes 'Automation' error
    I think it's the UNC path that's the problem, at any rate it's a mapped network drive. I saved my stencil (with macros) and template to the same dir on the network drive, then tried (both programmatically and manually) to add a ref to the stencil's VBProject from the template. No go, Automation error. Saved them both to a local drive, no problems. Any ideas why??
  • 3. Closing open embedded windows
    When I run an automated Bill of Material my Visio opens all embedded windows to search for tags. After the BOM has been produced these windows are still running in the processes. I have to manually close them by going into the task manager. This takes time and depending on the number of embedded drawings takes needed memory. Thanks, Derek
  • 4. Section, Row, Cell - working with Index
    Hello, I assign a Section-object via an index like (pseudocode) vsoSection = vsoShape.Section[1] a Row-object vsoRow = vsoSection.Row[1] and a Cell-object vsoCell = vsoRow.Cell[1] Now I have the following questions: 1. Is there any way to determine which (type of) section is contained in vsoSection? 2. Is it possible to dermine how many rows vsoSection contains? 3. Is there any way to determine which (type of) row is contained in vsoRow? 4. vsoSection->Count vsoRow->Count The Count-property determines what? 5. Is it possible to dermine how many cells/columns vsoRow contains? 6. The only way to iterate through all sections is to test whether one of the VisSectionIndices exists (via the Section- Exists-property of a Shape). Why is there no Sections-Collection? I know that I can access the values above via the Shape- object. It's just a question for understanding. Many thanks in advance. Udo
  • 5. Repeated Cell Changed Events
    I have an application that uses VBA to control a Visio 2003 document. When the user moves one of the shapes, it is detected through an event, which may or may not in turn move the shape again. What I am encountering is that the visEvtMod + visEvtCell event applied through AddAdvise is being evaluated over and over (circa 20 times before stopping) and I have not found any way of cancelling these repeated automatic "events". Any assistance would be greatly appreciated!

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.

David
(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


John Goldsmith
www.visualSignals.typepad.co.uk
www.visualSignals.co.uk








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
programmatically.

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
are

//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?

Marco

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
logic:

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,

David

4.Change shape background color on a visio stencil

Hello,

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 
VBA?

Thanks so much in advance.

Fox12 


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 2 guest