Visio Guy

Visio Discussions => Programming & Code => Topic started by: JamesB on August 27, 2018, 03:50:47 AM

Title: Building Custom Formula to update Text Fields
Post by: JamesB on August 27, 2018, 03:50:47 AM
I'm trying to create a shape, that has a text field.
When that shape is double-clicked, the shape duplicates.
The duplicated shape must
> Update text field when the original shapes text field changes.
> Be copy-able to other pages.

I have been able to achieve the first problem, by creating a custom Formula that references the original shape's text.

However, when I add the current page to the custom Formula. It resolves and removes that part of the formula.
i.e.
Within the macro, I build the following formula and place it within the shape;
=SHAPETEXT(Pages[Cover]!dataWireNum.70!TheText)

Now I open that shapes Custom Formula (with ctrl+F9)
This is what is displays
=SHAPETEXT(dataWireNum.52!TheText)

Is there a way to stop visio from shortening my custom formula?
Or maybe a better way to achieve this with UniqueID and the shapesheets?
Title: Re: Building Custom Formula to update Text Fields
Post by: Surrogate on August 27, 2018, 06:24:42 AM
Quote from: JamesB on August 27, 2018, 03:50:47 AM


Is there a way to stop visio from shortening my custom formula?
Visio core do this shortening! And we can't prevent it.
In this message (http://visguy.com/vgforum/index.php?topic=8522.msg37021#msg37021) you can find hint.
Instead "tst" in formula you need write page name where you created shape with this formula first time
Title: Re: Building Custom Formula to update Text Fields
Post by: vojo on August 27, 2018, 12:41:00 PM
if the new shape is on the same page (cover), it will eliminate because not needed.
if the new shap is on a different page, it will stay