Problems with creating a control handle

T

Torim

Good morning.

I want to create a control handle via VB Automation. For some reason
it doesn't work.

Here's the sample code I had in mind:

'========================================================================
dim msgdummy As Integer

dim Shape As Visio.Shape
dim ControlX As Visio.Cell
dim ControlY As Visio.Cell

.....
'Drop the Shape and do some other stuff
....

Set ControlX = Shape.CellsSRC(visSectionControls, visRowControl,
visCtlX)
Set ControlY = Shape.CellsSRC(visSectionControls, visRowControl,
visCtlY)

ControlX.Formula = 5 'just a random number
ControlY.Formula = 5 'just a random number

msgdummy = msgbox("ControlX = " & ControlX.ResultInt(vismillimeters,0)
msgdummy = msgbox("ControlY = " & ControlX.ResultInt(vismillimeters,0)
'========================================================================

Both msgbox's print "0" and if I take a look at the ShapeSheet the
respective control cells are empty.
Tried the CellsSRCExists function which told me that those two cells
don't even exist.

What am I doing wrong?
Any help would be appreciated

(using Visio 2002 pro)
 
A

Al Edlund

I guess my first question has to be whether you have a contols section in
the object.

visShape.AddSection visSectionControls

then you have to get the correct line to put the row in

intRowIndex = vsoShape.AddNamedRow(visSectionControls, _
strLocalRowName, VisRowIndices.visRowControl)

then finally you can consider putting some data in it

Set vsoCell = vsoShape.CellsSRC(visSectionControls, _
visRowControl + intRowIndex, visX)
vsoCell.Formula = strX

Your mileage of course may vary......

Al
 
T

Torim

Good morning.

I want to create a control handle via VB Automation. For some reason
it doesn't work.

Here's the sample code I had in mind:

'========================================================================
dim msgdummy As Integer

dim Shape As Visio.Shape
dim ControlX As Visio.Cell
dim ControlY As Visio.Cell

....
'Drop the Shape and do some other stuff
...

Set ControlX = Shape.CellsSRC(visSectionControls, visRowControl,
visCtlX)
Set ControlY = Shape.CellsSRC(visSectionControls, visRowControl,
visCtlY)

ControlX.Formula = 5 'just a random number
ControlY.Formula = 5 'just a random number

msgdummy = msgbox("ControlX = " & ControlX.ResultInt(vismillimeters,0)
msgdummy = msgbox("ControlY = " & ControlX.ResultInt(vismillimeters,0)
'========================================================================

Both msgbox's print "0" and if I take a look at the ShapeSheet the
respective control cells are empty.
Tried the CellsSRCExists function which told me that those two cells
don't even exist.

What am I doing wrong?
Any help would be appreciated

(using Visio 2002 pro)

D'oh nevermind.

I actually used the "addSection" command (just forgot to post it here)
but what I did not do was using the "addRow" command afterwards.

Sorry for that n00bish question :)
 

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