News:

BB code in posts seems to be working again!
I haven't turned on every single tag, so please let me know if there are any that are used/needed but not activated.

Main Menu

Summing Shape Data Category from each shape on a page

Started by calkevicius, August 14, 2020, 10:38:11 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

calkevicius

Say I have 5 shapes on a page and they all have a shape data category "Weight" which is set as a Number. Is it possible to create another shape on the page that will display the sum of all 5 shape weights? I'm sure there's a thread on here for such a simple request but I'm new here and I'm pretty new to VBA for Visio.  :)

vojo

2 cases

Case 1  shapes are static:
- all shapes are place on the page 1 time at beginning
- no new shape to include / none of the 5 shapes deleted
- thus the shape ID are well known

Then can do it via shapesheet functions
sum = sheet.1!prop.weight + sheet.2!prop.weight + etc

Case 2  shapes are dymanic
- different number of shapes place....3,4,5,6,7,etc shapes

then can do it via VBA

The issue is that a given shape is unaware of other shapes on the page
(no discovery of shapes, no communication of shapes, etc)
So need VBA.

Even a clumsy approach of each shape placing its weight in page!prop.weight1 or page!prop.weight2 has
limitations (finite max shapes, preload 0 in page props , need to figure out to 0 a weight out if shape deleted).

you should look at Junes calculation shapes for ideas.

calkevicius

Thank you for the reply. Option 2 is the way to go as I want it to work no matter which shapes are placed on the page. I'll check June's calculation sheet. You know any tutorials for VBA syntax? lol

Browser ID: smf (is_webkit)
Templates: 4: index (default), Display (default), GenericControls (default), GenericControls (default).
Sub templates: 6: init, html_above, body_above, main, body_below, html_below.
Language files: 4: index+Modifications.english (default), Post.english (default), Editor.english (default), Drafts.english (default).
Style sheets: 4: index.css, attachments.css, jquery.sceditor.css, responsive.css.
Hooks called: 170 (show)
Files included: 34 - 1306KB. (show)
Memory used: 1051KB.
Tokens: post-login.
Cache hits: 13: 0.00115s for 26,766 bytes (show)
Cache misses: 2: (show)
Queries used: 16.

[Show Queries]