Placing a formula into a user defined shape sheet cell

C

cpsriskanalyst

Howdy, Im having some issues with VBA, I am completely new to visio and the
VBA syntax in it is altogether unfamiliar to me.

I have an Org Chart and am attempting to modify the deltaY field in the
shapesheet of every shape on my page and I can do so with the following
code....

Sub Shift()
Dim docObj As Visio.Document
Dim pageIndex As Integer
Dim pagObj As Visio.Page
Dim shpIndex As Integer
Dim shpObj As Visio.Shape

Set docObj = ActiveDocument
For pageIndex = 1 To docObj.Pages.Count
Set pagObj = docObj.Pages.Item(pageIndex)
For shpIndex = 1 To pagObj.Shapes.Count
Set shpObj = pagObj.Shapes.Item(shpIndex)
If shpObj.CellExists("User.DeltaY", 0) Then
shpObj.Cells("User.DeltaY").Formula = "-2 in"
End If
Next shpIndex
Next pageIndex
Next
End Sub

This works great if I wanted a unified seperation...but I dont. I would
like to put in a formula to the effect of = -lookup(Prop.Sep,
"1;2;3;4;5")

essentially I have a Shape data field called 'Sep' which has my desired
seperation between every person and their direct superior.

But when i put this formula where the "-2 in" is in my code I get an
error... :(

is there a better way to go about this, or something I am missing???

Thank you so much for any help!
 

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