Get Custom Properties Values

A

AntonioG

Hello all,

I'm new in Visio developement and have a litte problem.

I created a Custom Properties row using Visio interface and I'm trying to
access its "Value" using Visual Basic. I wrote this code but the value
returned by Cells property of a shape object is always 0. The code follow:

Private Sub UserForm_Initialize()
Dim vsoShape As Visio.Shape
Dim vsoSelection As Visio.Selection
Dim vsoWindow As Visio.Window
Dim vsoCell As Visio.Cell
Dim str1 As String

str1 = "Prop.Row_2.Value"
Set vsoWindow = ActiveWindow
Set vsoSelection = vsoWindow.Selection
Set vsoShape = vsoSelection.Item(1)
If vsoShape.CellExists(str1, 0) Then ' The cell exists
Set vsoCell = vsoShape.Cells(str1) ' Always returns 0
' Any operation with vsoCell object causes an error
End If
End Sub

Please, could anyone help me ?

Thanks in advance.
 
J

JuneTheSecond

You would be adviced to use ResultStr property or Formula property to the
Cell object.
Dim vsoShape As Visio.Shape
Dim vsoCell As Visio.Cell
Dim str1 As String
str1 = "Prop.Row_2.Value"
Set vsoShape = ActiveWindow.Selection.Item(1)
If vsoShape.CellExists(str1, 0) Then
Set vsoCell = vsoShape.Cells(str1)
Debug.Print vsoCell.ResultStr("")
Debug.Print vsoCell.Formula
End If
 

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