Visio Guy

Visio Discussions => ShapeSheet & Smart Shapes => Topic started by: iankoe on November 08, 2008, 12:20:15 PM

Title: Getting the actual formula from a shapesheet cell
Post by: iankoe on November 08, 2008, 12:20:15 PM
I want to trigger some actions when one of my shapes "connects" to another of my shapes.  The best way I can see to do this is if I can figure out how to pull the formula out of the PinX cell rather than the value.  But I am stumped.

When the shapes are disconnected, PinX has a simple number in it Like (3.6353).  But when the shapes (both 2-dimensional) connect, Visio places formulas into the PinX/PinY cells of my target shape of the form:


=PNTX(LOCTOPAR(PNT(Int2.19!Connections.X3,Int2.19!Connections.Y3),Int2.19!EventXFMod,EventXFMod))+0 in


indicating that my local shape is pinned to a connection point in the shape: "Int2.19".

I figure, if I could get at teh formula, I could do some interesting things relating the two shapes, but that is where I am stumped.

Any help woudl be appreciated.
Title: Re: Getting the actual formula from a shapesheet cell
Post by: Yacine on May 08, 2009, 06:55:02 AM
In all the examples, that I found in the Web, the connection informations where gotten by VBA code. shape.connections... and so on.

I'm also looking for a solution to evaluate the string and not the value of a formula, so I can extract the connection shape's name without macro.

Community and VisGuy! any idea?
Title: Re: Getting the actual formula from a shapesheet cell
Post by: wapperdude on May 08, 2009, 03:40:04 PM
Here's a quick little macro that shows how to fetch the PinX formula.  (I tend to use msgbox instead of debug.print.)

Sub FetchCellFormula()
    Dim visShape As shape
   
    For Each visShape In ThisDocument.Pages(1).Shapes
        If visShape.Master <> "Dynamic connector" Then
            MsgBox visShape.CellsU("PinX").Formula
        End If
    Next
End Sub

HTH
Wapperdude
Title: Re: Getting the actual formula from a shapesheet cell
Post by: Yacine on May 08, 2009, 07:57:21 PM
Thank you Wapperdude,
the deal is not to get the connections through VB code, but to read it directly by a function in the shapesheet.
It is so frustrating to see the connection in a formula in front of you and not beeing able to handle it.