How to reference a cell in a shape on another page?

B

Beni shalom

Hi
I use formulas intensively and successfully in shapesheet
cells as long as the shape is on the same page or within
same group of shapes.
For example: Sheet.5!Controls.x1

How do I reference a cell of a shape in a different page?
How do I reference a cell of a shape in a different vsd
file or vss file?

Can anyone create for me a FUNCTION using VBA or C++ to
be used in shapesheet cells so I can reference other
page's shape cells.

For example:
User.Width = SHAPEPATH("WoodPricePage")!Wall!24.Width
or
User.Width = SHAPEPATH("Prices.vsd!WoodPricePage")!Wall!
24.Width
(Assuming SHAPEPATH( expression ) is a new function
created by you using C++ or VBA.

I am willing to pay for this functionally. Please quote
your price or your proposal.

Thank You

Beni Shalom
 
C

Chuck Bowling

Beni shalom said:
Hi
I use formulas intensively and successfully in shapesheet
cells as long as the shape is on the same page or within
same group of shapes.
For example: Sheet.5!Controls.x1

How do I reference a cell of a shape in a different page?

This isn't that hard. You just have to get a reference to the page like so:

dim pg as Visio.Page
dim shp as Visio.Shape
dim sngWidth as Single

set pg = ActiveDocument.Pages("WoodPricePage")
set shp = pg.Shapes("Wall.24")

sngWidth = shp.Cells("Width").ResultIU
How do I reference a cell of a shape in a different vsd
file or vss file?

To do that you have to use the Document.Open method like so:

dim doc as Visio.Document
dim pg as Visio.Page
dim shp as Visio.Shape
dim sngWidth as Single

set doc = Documents.Open("My Path\My Drawings\Prices.vsd")
set pg = doc.Pages("WoodPricePage")
set shp = pg.Shapes("Wall.24")

sngWidth = shp.Cells("Width").ResultIU
Can anyone create for me a FUNCTION using VBA or C++ to
be used in shapesheet cells so I can reference other
page's shape cells.

For example:
User.Width = SHAPEPATH("WoodPricePage")!Wall!24.Width
or
User.Width = SHAPEPATH("Prices.vsd!WoodPricePage")!Wall!
24.Width
(Assuming SHAPEPATH( expression ) is a new function
created by you using C++ or VBA.

I am willing to pay for this functionally. Please quote
your price or your proposal.

I am available for contract work. If you need something done drop me a line.
 
M

Mark Nelson [MS]

You don't need code to reference cells in other pages, as long as the
information is in the same document. Visio does not support shapesheet
references to other documents, so you would need some code to copy
information from one doc to another.

Here is an example for a cell reference: Pages[Page-3]!Sheet.4!BeginX

Note that shapes must be designated using their SheetID, not their regular
names. Therefore Door.4!BeginX will usually be invalid, but Sheet.4!BeginX
is valid.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top