View Single Post
 
Old 05-19-2022, 02:41 AM
Claudiu Claudiu is offline Windows 10 Office 2016
Novice
 
Join Date: May 2022
Posts: 3
Claudiu is on a distinguished road
Exclamation Define shape data property name field missing 2016 vs 2013

Hi all,

I have been working for a while with MS Visio 2013 and created some shapes which has some data associated. For each data property in Visio 2013 there are some properties to set: Label, Name, Type, ... :
Visio 2013.PNG
BUT for Visio 2016 the Name field now is missing:
Visio 2016.PNG

My current code can find a property by using this code using VBA:
Code:
Public Function GetCustomPropertyValue(currentShape As Visio.Shape, propertyName As String) As String
    Dim iPropSect As Integer
    Dim intResult As Integer
    
    iPropSect = Visio.VisSectionIndices.visSectionProp
    If currentShape.SectionExists(iPropSect, Visio.VisExistsFlags.visExistsAnywhere) <> 0 Then
        Dim j As Integer
        
        For j = 0 To currentShape.Section(iPropSect).Count - 1 Step 1
            Dim vCell As Visio.Cell
            Set vCell = currentShape.CellsSRC(iPropSect, j, Visio.VisCellIndices.visCustPropsValue)
            
            intResult = StrComp(vCell.RowNameU, propertyName)
                        
            If intResult = 0 Then
                'GetCustomPropertyValue = vCell.ResultStr("")
                GetCustomPropertyValue = Replace(vCell.Formula, """", "")
            End If
        Next j
    End If
End Function
It is strange that the code is working fine with the names set in Visio 2013 and the Label and Name contains different string values.
Like:
- Label: Some text here
- Name: someText

So now, I don't know if this is a bug from MS Visio or the Name field was removed and something happens behind the scene.

Thank you in advance for your time!
Reply With Quote