page name in different page

Started by novski, April 08, 2014, 01:40:33 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

novski

Hi
I mangaged to get the pagename of my active page in to a shape.
But, how can i get the pagename of a page that is not active?

Jumpy


novski

hi
I tried to get that working but unfortunately i can't make it.
Are you shure thats the right code?


wapperdude

#3
The pagename() is pretty rude.  It works well in title blocks, and on the active page.  To make it reference a non-active page, is almost more work than just entering the name manually.  But, as far as I can tell, you need to do the following:

Background:  let's say my non-active page is (was) page-2, but I renamed it to MyPage in the page tab.

Go to MyPage and open its shapesheet.
>  Insert User-Defined section
>  Rename the row to PgName
>  in the Value cell, enter pagename()

Close shapesheet, and go to desired page.  Select shape you want to show the page name, MyPage.

Insert>Field>Custom Formula:  Pages[MyPage]!ThePage!User.PgName

The trick is that every page would need, in this case, a User-Defined section, with a row named PgName, and a Value formula "pagename()" no quotes.  Then, in the shape on the active page, you must specify which non-active page, and call the User.PgName entry.

I think there may be some posts to do this via code on this site, try searching for pagename().

HTH
Wapperdude.

Visio 2019 Pro

novski

#4
Hi
Thanks for that. I found some help in a bvisiual post. I managed to get the
http://blogs.msdn.com/b/visio/archive/2006/06/27/647570.aspx?CommentPosted=true#commentmessage
OffPageReference working with link but the Text doesn't show the Linked page name.
Instead it shows the page name it is sitting on. On the last Picture of this post
http://blog.bvisual.net/2011/09/02/page-grids-and-off-page-references/
i see that his shape shows the name of the page it refers to...

thats exactly what i whant to do. but how?

best regards
novski

wapperdude

#5
A little confused here...are you interested in using the offpage connector shape?

You need to do a few steps that are indicated in the referenced post...

1.)  Drop an offpage connector onto your page and delete it.  This creates a master in the document stencil.  Note, this is only available in the current document.  After editing, you could save the modified mastershape to a custom stencil, and then it would be available for other documents.

2.)  Then edit this master to Match name on drop and to sync the text as described.

3.)  Now, edit the master shape's shapesheet:
      a.)  Add User Defined section
      b.)  Add new row and give it a catchy name, or not, like user.EqPageName.
      c.)  In the value cell, enter pagename().

      d.)  Add Hyperlink section
      e.)  Change row name to Hyperlink.OffPageConnector.  This is critical, because when you create an offpage reference, the code will generate this row.  But, this row must pre-exist in order to make a valid field insert below.

4.)  Go back to the master shape drawing page, and then Insert>Field>Custom. Enter the following formula, using whatever name you used in 3b above:  User.EqPageName&CHAR(10)&Hyperlink.OffPageConnector.SubAddress

Close the shapesheet, close and save the master shape drawing page. 

Explanation: 
The formula will show two entries:  1st, the current page and 2nd the linked pagename.  if you don't want the current page name, just delete the User.EqPageName&char(10)&, keeping only the hyperlink info.

This only works because of the built-in functionality of the offpage connector.  Hopefully, I have all of the steps, and have them correctly indicated.

HTH
Wapperdude
Visio 2019 Pro

wapperdude

Making the hyperlink trick a little more general, to grab a non-active page name, you could do the following:

Place a shape on the active page.  Create a hyperlink.  Go to Insert, Fields, custom and enter this formula:  Hyperlink.Row_1.SubAddress.  This doesn't have any of the add-on code that the off-page reference shape has, but, if all you need is the off-page name (and the "bonus" of hyperlinking), than this should work fine.

If you want your shape to show more pages, you just add more hyperlinks.  Each new hyperlink inserts a new line in the hyperlink section.  You can then expand the custom field formula to something like:  Hyperlink.Row_1.SubAddress&CHAR(10)&Hyperlink.Row_2.SubAddress

This has the benefit that if you right click on the shape, the pop-up context window allows you to select which page you'd like to navigate to.

HTH
Wapperdude
Visio 2019 Pro

Yacine

Yacine

novski

Thanks a lot! That worked!
Novski