Shape data as index in array (Visio 2010)

Started by Regis_CZ, September 30, 2010, 02:42:34 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Regis_CZ

Hello Everybody,
I am trying to use shape data Prop.LayerId (Type=2(Number)) as index in ThePage!Layers.Visible[n] in ShapeSheet. First I tried simple ThePage!Layers.Visible[Prop.LayerId], then ThePage!Layers.Visible[Prop.LayerId.Value]
But Visio complains about error in formula. So I searched and found this example:
ThePage!Layers.Visible["&INDEX(0,LayerMember)+1&"] so I tried ThePage!Layers.Visible["&Prop.LayerId&"]
ThePage!Layers.Visible["Prop.LayerId"]
ThePage!Layers.Visible["Prop.LayerId.Value"]

but no luck.

Visio actually select the formula form the opening [ asi if anything but simple number would not be permited inside []. I am out of ideas ??? so I came here. Thanks in advance for any suggestions.

Regis

Regis_CZ

So, I have found an answer, sort of:
http://visguy.com/vgforum/index.php?topic=1713.0
It seems the suggested solution either does not work or it was "fixed" in Viso 2010. GetRef(Prop.INT_NETPT_DEST1) references the prop cell itself. GetRef(Prop.INT_NETPT_DEST1.Value) reverts automatically to GetRef(Prop.INT_NETPT_DEST1).

So it seems I am screwed as VBA is not an option (counts as Macro).

Sorry I didn't find the original topic at first but I really tried. :-[

Jumpy

Hi Regis,
because I don't know, why you want to use that approach and because I don't know how many hundreds of layers you have, I'm so bold as to suggest sth. different. In another article VisioGuy shows, that you can put a really big number of nested If..Then statements inside a Visio Formula. So I guess that whatever you want to accomplish can be accomplished otherwise.

This may be awkward, but in the same article VisioGuy shows a simple VBA solution to create the 50+ nested If statements. That VBA is a onetime thing and has nothing to do with the later result, so it should not screw you.

Perhaps if you could say what you want to happen, if you select a LayerIndex, we can help more.

Jumpy



Regis_CZ

Hello Jumpy,
Thank you for your response. Here is the full story.

I have fixed set of shapes placed on canvas and those shapes can be connected in various ways one to another. Idea is to create a new layer for each required connection combination. There are hundreds of combinations. I would like to have a shape which can be easily associated with a layer (via shape data I guess) and this shape would then: hold comment unique to that layer, display callout with layer name, have color picked from list of colors based on that layer index and would turn layer visibility on and off on double click and/or right click menu action.

I can create callout based on shape data, I can create the action to turn visibility (thanks to VisioGuy), I did not investigate the color picking in detail but I have some ideas which may hopefully work. I can pretty much implement everything I want to but whenever I add a new layer I have to manually change some 10 ShapeSheet fields to associate it with particular shape.

Perhaps in the end I will have to create VBA script which edits the fields for me on shape/layer creation and will not be required for viewing the drawing later...