Author Topic: page name in different page  (Read 10848 times)

0 Members and 1 Guest are viewing this topic.

novski

  • Full Member
  • ***
  • Posts: 182
page name in different page
« on: April 08, 2014, 08:40:33 AM »
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

  • Hero Member
  • *****
  • Posts: 1061
Re: page name in different page
« Reply #1 on: April 08, 2014, 10:35:42 AM »
Pages[Page-3].Pagename()

novski

  • Full Member
  • ***
  • Posts: 182
Re: page name in different page
« Reply #2 on: April 15, 2014, 09:53:24 AM »
hi
I tried to get that working but unfortunately i can't make it.
Are you shure thats the right code?


wapperdude

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4479
  • Ideas Visio-lized into solutions
Re: page name in different page
« Reply #3 on: April 15, 2014, 12:22:51 PM »
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.

« Last Edit: April 15, 2014, 12:29:08 PM by wapperdude »
Visio 2019 Pro

novski

  • Full Member
  • ***
  • Posts: 182
Re: page name in different page
« Reply #4 on: April 17, 2014, 03:06:07 AM »
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
« Last Edit: April 17, 2014, 03:08:38 AM by novski »

wapperdude

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4479
  • Ideas Visio-lized into solutions
Re: page name in different page
« Reply #5 on: April 17, 2014, 07:58:07 PM »
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
« Last Edit: April 17, 2014, 08:02:36 PM by wapperdude »
Visio 2019 Pro

wapperdude

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4479
  • Ideas Visio-lized into solutions
Re: page name in different page
« Reply #6 on: April 18, 2014, 11:08:05 AM »
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

  • Hero Member
  • *****
  • Posts: 3004
Re: page name in different page
« Reply #7 on: April 18, 2014, 03:52:56 PM »
Nice!
Yacine

novski

  • Full Member
  • ***
  • Posts: 182
Re: page name in different page
« Reply #8 on: April 22, 2014, 03:07:39 AM »
Thanks a lot! That worked!
Novski