Author Topic: Couldn't able to read data from container text area  (Read 195 times)

0 Members and 1 Guest are viewing this topic.

sruikar

  • Newbie
  • *
  • Posts: 1
Couldn't able to read data from container text area
« on: January 16, 2020, 12:47:25 PM »
Hi all ,

I'm trying to read data from visio container which is written in the text area through vba script and writing same in notepad,  but couldn't fetch data for any container.

I'm adding attachment of vsd file . Any help will be appreciated.


Tried Code sample :

 For Each memberID In vsoContainerShape.ContainerProperties.GetMemberShapes(visContainerFlagsDefault)
       
            Set vsoShape = vsoPage.Shapes.ItemFromID(memberID)
            'shape_details = "BlOCK_START"
            intRows = vsoShape.RowCount(Visio.visSectionProp)
            Debug.Print vsoShape.Text
           
             
           
            'If intRows > 0 Then
             
            'Debug.Print vsoShape.Text
            'sample_one = shape_details + sample_one + vbCrLf + vsoShape.Text
            shape_details = "BlOCK_START" + vbCrLf + vsoShape.Text
            sample_one = sample_one + shape_details '+ sample_one + vbCrLf + vsoShape.Text
            sample_one = sample_one + vbCrLf + "BlOCK_END" + vbCrLf
            Set shape_details = Nothing
            Debug.Print sample_one
           
            'End If
             
        intRows = 0
        Next
        openContainer = sample_one & vbCrLf & "**END**"

Thanks in advance

Obsidian

  • Jr. Member
  • **
  • Posts: 12
    • AIGS GraFiS-Tactic
Re: Couldn't able to read data from container text area
« Reply #1 on: January 17, 2020, 03:54:14 AM »
Hello! If i correctly understand your question, for resolve your problem you need tio use recursive shape select:

Code
Public Sub Main()
Dim shp As Visio.Shape
       
    'start "PrintShapeText" calls
    For Each shp In Application.ActivePage.Shapes
        PrintShapeText shp
    Next shp
   
End Sub

Private Sub PrintShapeText(ByRef shp As Visio.Shape)
Dim subShp As Visio.Shape
   
    Debug.Print shp.Name & ".text = " & shp.Text
   
    If shp.Shapes.Count > 0 Then
        'recurse "PrintShapeText"  call
        For Each subShp In shp.Shapes
            PrintShapeText subShp
        Next subShp
    End If
End Sub
And may be from the darkness something beautiful will rize