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

VISIO

    Sponsored Links

    Next

  • 1. Visio 2007 SDK ShapeStudio
    I am having some challenges getting ShapeStudio to work on Visio 2007. I downloaded the Visio 2007 SDK and installed it. I have run the script on my local installation of SQL Express and created the database. When I open Visio and select Tools | Add Ons | SDK | ShapeStudio, I am presented with a data page. I'm given the option of adding a new one. When I try to add, I'm told that I don't have administrative privileges. I walk through the process - I have a DSN, I just can't access it. Please advise how to fix this so that I can start working with this tool. I'm running Windows Vista SP1. Other than that, it's a very plain vanilla installation. Thanks, Flavelle
  • 2. interrogate shape info using vba
    Hello all, I'm a newbie to VBA, I'd posted a question on th ShapeSheet forum, and Paul had given me some good directions. But unfortunately, I still couldn't do what I hope to achieve. How could I get info from a ShapeSheet's cell with VBA? And how could I use VBA to change the value of the cells? Any help would be appreciated. Cheers,
  • 3. generating visio documents from text files
    (Visio 2007) What I really want to do is a little complicated to explain so let's say I want to allow text driven creation of visio documents. I've done this kind of thing before with Word and Excel but it was a few years ago. Back then I think I used VB 6 stand alone to open the document templates and do what I needed to do. Worked great. Everyone was happy. Now I can't even figure out how to download VB 6. The VB Editor invoked by tools/macro in Visio can't seem to open/compile the Visio SDK sample vbp file I want to look at. I've been cruising around the M/S site for a couple of hours but that is about my limit before I post questions like this. Why can't I open the Visio SDK sample vbp in the Visio VB Editor? Is it really that crippled? If I want to write a stand alone (eliminate the user having to open Vision) app to generate a visio document from a text file, what do I write it in? Or more, directly, is there a zero cost language solution or do I have to get Visual Studio 200X to get VB 6?
  • 4. Get shape connection information
    After selected a shape, how to create a list of all the connectors connected to the selected shape ? and also a list of all the other shapes which are connected to the selected shape through direct connectors ?
  • 5. VBA Help
    I want to know how can I make a procedure, when I click a command button then a visio file to be opened(ex; a visio file from My Documents or in any other directory). And also I want to get some examples done with Visio and VBA.

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