Help!

Just started VBA tonight, in need of help.

 
  

Post new topic   General Reply to Topic (not reply to a specific post)    Forums Home -> Creating Shapes RSS
Next:  Updating consecutive records not saving changes  
Author Message
Furyofaseraph



Joined: Mar 31, 2009
Posts: 1



PostPosted: Tue Mar 31, 2009 2:20 am    Post subject: Just started VBA tonight, in need of help.

Hey guys,

I just started playing with visio's VBA tonight and its a wonderful thing, I've discovered. I do have a bit of a dilema, however.

I have a bunch of shapes that are connected in a flowchart fashion. Each shape has a property called "TheProperty" for the sake of this example. "TheProperty" is a boolean that I can change. What I've got is if "TheProperty" is true, the shape will turn green, if its "false" the shape will turn red.

What I'd like to do is to add another 'state' as it were. I would like to make it so that when I run the macro, the shape will change to blue if all the shapes that are connected to it (but not connected from it) have "TheProperty" as true for all of them.

Again, the real dilema, I'm sensing, is that I have to make a distinction between connections coming in vs connections going out and I don't know how to do that.

Here is my current code.
Code:

Sub Test()
Dim pag As Page
Dim shp As Shape

Set pag = Application.ActivePage
For Each shp In pag.Shapes
 If shp.CellExists("Prop.TheProperty", True) = True Then
    If (shp.Cells("Prop.TheProperty") = False) Then
        shp.Cells("FillForegnd") = 2
        shp.Cells("Char.Color") = 1
    Else
        shp.Cells("FillForegnd") = 3
        shp.Cells("Char.Color") = 0
    End If
' Here's where I need to have the thing mentioned above
    If (shp.FromConnects.Count > 0) Then
        shp.Cells("FillForegnd") = 4
        shp.Cells("Char.Color") = 0
    End If
       
 End If
 Next shp
 Set shpObj = Nothing
 Set shpObjs = Nothing

End Sub



I apologize if I am not clear. It's rather early in the morning. I would appreciate any direction someone could give me on this. If anyone needs clarification, let me know.
Back to top
Display posts from previous:   
Post new topic   General Reply to Topic (not reply to a specific post)    Forums Home -> Creating Shapes All times are: Eastern Time (US & Canada) (change)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum