ShapeText Function across pages

Started by DazedNConfused, February 04, 2014, 04:37:36 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

DazedNConfused

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...


Paul Herber

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)
Electronic and Electrical engineering, business and software stencils for Visio -

https://www.paulherber.co.uk/

DazedNConfused

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?

Paul Herber

I'd say this forum is the best place, just look at the many code examples.
Electronic and Electrical engineering, business and software stencils for Visio -

https://www.paulherber.co.uk/

DazedNConfused

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.

DazedNConfused

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.

Nama

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?

Surrogate

Visio have local and universal names for shapes and pages
Name and NameU

russian interfaceenglish interface

Nama

That was exactly it. Thank you so much!!