Change on shape data

Started by Emilien, February 16, 2013, 10:24:30 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Emilien

Dear all,

After many research on the subjet, I have decided to ask for your help. I'm new on Viso and pretty new on VB.

I have a shape with 2 fixed list for shape data :
List 1 : A ; B ; C
List 2 : 1 ; 2 ; 3

Some combinations are impossible. We can't have A-3 and C-2. All other are possible.

I have found a way to run a macro for those two impossible set (add if(...,runmacro("..."),False) in the shapesheet). The problem is I haven't only one shape on my document so I need to find an other way to avoid impossible combinations.

I think that the best way is to track any change on all row of all shape on my document with VBA to compare the new set with a excel sheet were all impossible combinations are indicated. But I really don't know how to do this.

Please could you help me to solve my problem. Do not hesitate to propose other solution if you think the excel sheet is not the good way.

Thanks

Emilien

Yacine

Hi Emilien,
do you want to make a shape that offers only valid combinations, so to exclude the invalid values from the dropdown list of the shape data, or do you want to mark invalid shapes that exist already in your drawing?
Yacine

Emilien

Hi Yacine,

My shapes are already created but it's not a problem for my to make them again by excluding invalide combination value on my lists if it's the easiest way.

Your two proposition looks good to me.

Thanks

Emilien

Yacine

Hi Emilien,
check the shape sheets of the 3 shapes in the attached file.
Hope that helps,
Y.
Yacine

Emilien

Yacine,

The 3 solutinos looks good for me but I have an additional question.

As you can imagine, some of my colegue are not at ease with visio shapesheet, but they can create new shape. Do you have any automatic solution with an unique VB macro attached to an excel sheet for exemple.

In the sheet you only get good combination (or false one) and the macro is running each time a shape data is changed to verify the combination ?

Thanks for you help.

Emilien

Jumpy

Look at the shape sheet functions:

http://msdn.microsoft.com/en-us/library/office/jj735243.aspx

You need a userdefined cell with
=DEPENDSON(Prop.YourPropData)+CALLTHIS(MyMacro)

And the Macro with the following form:

Sub MyMacro(shp as Visio.Shape)
  'shp is the shape, that called the macro and you can use it to verify that shapes ShapeData
End Sub


But remember: You can do that in the ShapeSheet, too. You do not neccesarily need VBA. A user defined cell that looks:
=If(And(Prop.MyProp1=1;Prop.MyProp2=2);SETF(GETREF(Prop.MyProp2),3);"")

That formula checks, if you have the forbidden situation Prop1=1 and Prop2=2, and reacts in setting Prop2 to 3.
Just an example. Instead of changing the value you could colour the shape red or sth.

Emilien

Thanks for all you reply.

If I can abuse of your kindness, do you know if a command exist on VBA to track change on all prop.xxx cells of all shape on a page.

Thanks

Jumpy

No. There's no event like that and I believe it would be overkill. Imho it's best to use "ShapeSheet-Magic" whenever possible and only use VBA when neccessary. But that's just me.