Visio Guy

Visio Discussions => Shapes & Templates => Topic started by: DazedNConfused on February 04, 2014, 04:37:36 AM

Title: ShapeText Function across pages
Post by: DazedNConfused on February 04, 2014, 04:37:36 AM
Hi All,

I'm aware this is a basic request, but for the life of me, I can't get it to work.

I'm trying to set the value of a shape on each page the same as a shape on the first page (for version purposes). From what I've read, what should be an easy way is to use the ShapeText function (as per this post: http://visguy.com/vgforum/index.php?topic=5038.0;prev_next=prev#new)

To test, I created a new document (and didn't rename any sheets). I can get 1 shape to equal another on the first page by using: =SHAPETEXT(Process!TheText). However, I get an "error in formula" message when I try to add the page reference: =SHAPETEXT(Pages[Page-1]!Process!TheText). Needless to say, it doesn't work when I try it on page 2.

All the posts I can find show it should be very simple so don't know what's going wrong.

Appreciate your time...

Title: Re: ShapeText Function across pages
Post by: Paul Herber on February 04, 2014, 10:03:52 AM
It's the shape reference you need to change, Visio uses Sheet references. In Visio 2010 onwards use the Developer -> Shape Name dialog, in earlier versions it is Format -> Special. Look at the ID field. Use that field as follows e.g. if the ID is 7:
=SHAPETEXT(Pages[Page-1]!Sheet.7!TheText)
Title: Re: ShapeText Function across pages
Post by: DazedNConfused on February 05, 2014, 01:27:26 AM
Thanks Paul - that fixed it!

I come from a Excel VBA background, so the Sheet reference is a little confusing. Any good online articles you'd recommend for a fella to understand this better?
Title: Re: ShapeText Function across pages
Post by: Paul Herber on February 05, 2014, 07:07:29 PM
I'd say this forum is the best place, just look at the many code examples.
Title: Re: ShapeText Function across pages
Post by: DazedNConfused on February 06, 2014, 03:16:30 AM
Thanks Paul - will do.

If I could be so bold as to sneak in a related question... now that I've got the link working, I wanted to make it easier for my collegues to adjust (without playing with the formula).

So my idea was to add 'LinkedPage' and 'LinkedShapeID' as shape data. I then want to reference these fields in my ShapeText formula. Have played with various approaches, but clearly my lack of understanding of how formula work is not helping!

=EVALTEXT("SHAPETEXT(Pages[" & Prop.LinkedPage & "]!Sheet." & Prop.LinkedShapeID & "!TheText)")

This recreates the formula in string format, but EVALTEXT appears to be more for numeric calculations.

By the way, let me know if I should post this as a new topic... I just figured it flowed on from the earlier question.

Appreciate your time.
Title: Re: ShapeText Function across pages
Post by: DazedNConfused on February 06, 2014, 05:10:48 AM
It would appear I have trouble letting things go...

So not sure if this is the best fix or a workaround. Added a working cell, to which I added:

=SETF(GetRef(Prop.ShapeText),"GUARD(TRIM(SHAPETEXT(Pages["&Prop.LinkedPage&"]!Sheet."&Prop.LinkedShapeID&"!TheText)))")

Appears to work. Always interested in improving so let me know if there's a better way (I figure there should be something that doesn't require a working cell.
Title: Re: ShapeText Function across pages
Post by: Nama on April 19, 2016, 02:13:35 PM
Quote from: Paul Herber on February 04, 2014, 10:03:52 AM
It's the shape reference you need to change, Visio uses Sheet references. In Visio 2010 onwards use the Developer -> Shape Name dialog, in earlier versions it is Format -> Special. Look at the ID field. Use that field as follows e.g. if the ID is 7:
=SHAPETEXT(Pages[Page-1]!Sheet.7!TheText)

I've been trying everything to get this working, but when I attempt to enter the below into custom formula I just get "Error in formula" and everything is highlighted. Is there a change in the syntax in Visio 2013? I've verified the Page Name and Shape ID.

=SHAPETEXT(Pages[DM Fundraising Pt1]!Sheet.733!TheText)

I'm attempting to get the page number from another page for a printed reference rather than manually updating the page numbers when pages are added/removed/reordered. Is there a different way that I should pull that information?
Title: Re: ShapeText Function across pages
Post by: Surrogate on April 19, 2016, 02:34:46 PM
Visio have local and universal names for shapes and pages
Name and NameU (https://blogs.msdn.microsoft.com/visio/2006/07/27/name-and-nameu/)

russian interfaceenglish interface
(http://forumimage.ru/uploads/20150219/142435533371343534.gif)(http://forumimage.ru/uploads/20150219/142435559524707154.gif)
Title: Re: ShapeText Function across pages
Post by: Nama on April 19, 2016, 05:48:45 PM
That was exactly it. Thank you so much!!
Browser ID: smf (is_webkit)
Templates: 1: Printpage (default).
Sub templates: 4: init, print_above, main, print_below.
Language files: 1: index+Modifications.english (default).
Style sheets: 0: .
Hooks called: 69 (show)
Files included: 25 - 925KB. (show)
Memory used: 748KB.
Tokens: post-login.
Cache hits: 8: 0.00153s for 22,302 bytes (show)
Cache misses: 2: (show)
Queries used: 11.

[Show Queries]