Solved: How to link shapes across multiple sheets?

Started by Nelax, November 20, 2008, 10:02:07 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Nelax

Hi,
how do I link data between shapes on different sheets?

I have attached an example:

Sheet AAA
2 Boxes with Values for the Shape Data cell 'Color'
- Box and Box.4

Sheet BBB
- Box.4

When I change the value for 'Color' in shape 'Box' on sheet AAA, 'Box.4' will change its value also. What is the formula for 'Box.4' on sheet BBB to get the same behavior as 'Box.4' on sheet AAA?

Nelax


Visio Guy

Hi Nelax,

It sounds like you want to build what we often call "Cross-sheet References."

This might help:

Elements of Visio Formulas

About half-way down the page is a nice table which shows the syntax of the various possibilities: "Summary of cell reference syntax"
For articles, tips and free content, see the Visio Guy Website at http://www.visguy.com
Get my Visio Book! Using Microsoft Visio 2010

Nelax

Hi Visio Guy,
thanks for your reply. My guess it should be this formula for the shape date in 'Box.4' at sheet 'BBB' then:

=Pages[AAA]!ThePage!Box!Prop.Color

but somehow visio tells me that there is an error in the formula. Any ideas?  ???

Visio Guy

Hmm,

I think there is a bit of a bug here.

Your page has been renamed more than once. If you go to the VBA editor and type the following in the Immediate window, you'll see the results:

?Visio.ActivePage.Name
AAA

?Visio.ActivePage.NameU
Page-1

Even if you clear out the name for the page, then reset it, it doesn't reset the "U" name -- the Universal name, but the formula seems to require the universal name.

So you can do one of two things:

1. Change your formula to use the Universal name:
  =Pages[Page-1]!ThePage!Box!Prop.Color

2. Reset the Universal name. In the VBA immediate window, type:
   Visio.ActivePage.NameU="AAA"

This is really confusing and you shouldn't have to know crazy details like this!

For articles, tips and free content, see the Visio Guy Website at http://www.visguy.com
Get my Visio Book! Using Microsoft Visio 2010

Nelax

Hi,
thanks so far for your help, but I just can't access shapes across pages, if I add an user-defines value to the page itself I can reference it. Could you or anyone else post a simple working example of the cross-sheet reference from one shape to another on a different page please?

This is what I get (german version of visio) when I try to use =Pages[Page-1]!ThePage!State!Prop.Cost

The message translates to:
QuoteError in the Formula.


Nelax

ok, this is sick.

I have solved the problem for the file foo.vsd attached to an earlier post:

the correct formula for the box on page 'BBB' is:
=Pages[Page-1]!Sheet.1!Prop.Color
You have to adress the object by its ID, which you get from FORMAT > OBJECT DATA (upper left corner, ID)

when it is entered, it automatically transforms into
=Pages[Page-1]!Box.1!Prop.Color

when you edit it again, and don't change anything in the formula and press enter you get the message as in the screenshot above.

is this somehow bugged or is that a feature?  :)