Visio Guy

Visio Discussions => ShapeSheet & Smart Shapes => Topic started by: Miki on April 30, 2015, 03:38:08 PM

Title: Shape text based on existing shapes on page
Post by: Miki on April 30, 2015, 03:38:08 PM
Hello,
I have an "Area" shape which I created to assign different area types. Basically what this shape does is when you drop it on the page, it asks you to select whether it is Area C, Area D or Area E. Once you select, lets say you selected "Area C", the the text in the shape will say its name and area (For e.g.: "Area C: 2 acres").
What I need to do is, if I drop the shape and select "Area C", then it should scan the page to see if there is any "Area C" already on the page or not. If there are no "Area C" on the page then the text should say "Area C1: 2 acres". If there is one "Area C" on the page, then the text should say "Area C2: 2 acres".
I want to know if this is possible by doing something in Shapesheet or do I have to write a code for that.

Any help is appreciated.

Thanks,

- Miki

PS: Don't know if I have posted in the correct location. Thought this is a shapesheet question.
Title: Re: Shape text based on existing shapes on page
Post by: Yacine on April 30, 2015, 04:41:02 PM
Hi Miki,
Your problem can be solved - but not without code.
The trick is to call a macro whenever a new shape is dropped or the area type changes.
This is done by the shapesheet function CALLTHIS.
In the macro, you would then iterate through all the shapes of the active page, check if the found shape has the right cells and the right values in the cells, then increment a counter.
At the end the counter will be assigned to the "number" field of the shape.
This is of course a very primitive method as it does not consider shapes that could have been deleted meanwhile. There's been a long discussion about this issue in the forum a while ago, but I could not find it. You may try finding it by yourself.

I attach a drawing in which I demonstrate the idea.
Title: Re: Shape text based on existing shapes on page
Post by: Miki on April 30, 2015, 05:23:37 PM
Thanks Yacine!
I had this thing in mind but wanted to know if I could do it without the code.
Thanks for the  prompt response.
I'll try the to find if I can tackle the issue of deleted shape. Will post it here if I am successful.

- Miki
Title: Re: Shape text based on existing shapes on page
Post by: Yacine on May 01, 2015, 07:54:59 AM
Most important is to decide whether you want to fill in gaps or just take the highest available number.
(Versioning issue)