Counting Shape Data Fields (Rows)

Started by Hamwic, November 09, 2015, 09:58:42 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Hamwic

I'm trying to write a little routine that will need to count the number of data fields/rows contained in a shape. The fields have named (EmployeeName, Band, StartDate,EndDate etc.) rather than having "Row_0", "Row_1", "Row_2" etc..

The field (Row) names can change depending on the shape, so cannot hard code the name in. What I was thinking is writing a loop and adding one on ech pass so that I can lookup the row number, i.e.

Sub Counting_Fields

vsoShape As Visio.Shape
Dim intCount as Integer
Dim strPropRow as String

IntCount = 0

        For Each vsoShape In vsoPage.Shapes
            intPropRow = vsoShape.Cells("prop.Row_" & intCount)
            intCount = intCount + 1
       Next

End Sub

As Row_0 is actually named as Employeename, I cannot use the above syntax. I need to find a way of counting each row without using the field name.

p.s. intCount will be used elsewhere, I cut the whole routine down just to include whjat I thought was relevant

Thanks in advance!

Paul Herber

(this is Delphi/FreePascal syntax but the idea should be the same.)


rows := shpObj.RowCount[visSectionProp]

Electronic and Electrical engineering, business and software stencils for Visio -

https://www.paulherber.co.uk/

Hamwic


Paul Herber

Electronic and Electrical engineering, business and software stencils for Visio -

https://www.paulherber.co.uk/

Browser ID: smf (is_webkit)
Templates: 4: index (default), Display (default), GenericControls (default), GenericControls (default).
Sub templates: 6: init, html_above, body_above, main, body_below, html_below.
Language files: 4: index+Modifications.english (default), Post.english (default), Editor.english (default), Drafts.english (default).
Style sheets: 4: index.css, attachments.css, jquery.sceditor.css, responsive.css.
Hooks called: 191 (show)
Files included: 32 - 1218KB. (show)
Memory used: 1085KB.
Tokens: post-login.
Cache hits: 13: 0.00286s for 26,582 bytes (show)
Cache misses: 2: (show)
Queries used: 17.

[Show Queries]