Shape.RowCount-Eigenschaft (Visio)

Gibt die Anzahl der Zeilen im Abschnitt ShapeSheet zurück. Schreibgeschützt.

Syntax

Ausdruck. RowCount( _Section_ )

Ausdruck Eine Variable, die ein Shape-Objekt darstellt.

Parameter

Name Erforderlich/Optional Datentyp Beschreibung
Section Erforderlich Integer Der Abschnitt, dessen Zeilen zu zählen sind.

Rückgabewert

Ganze Zahl

HinwBemerkungeneise

Das Argument Section muss eine Abschnittskonstante sein. Eine Liste der Abschnittskonstanten finden Sie im Thema zur AddSection-Methode.

Verwenden Sie die RowCount-Eigenschaft hauptsächlich mit Abschnitten, die eine variable Anzahl von Zeilen enthalten, z. B. Geometry- und Verbindungspunkteabschnitte. Für Abschnitte mit einer festen Anzahl von Zeilen gibt die RowCount-Eigenschaft die Anzahl der Zeilen im Abschnitt zurück, die mindestens eine Zelle besitzen, deren Wert für die Form lokal ist, im Gegensatz zu Zeilen, deren Zellen alle von einem Master oder einer Formatvorlage geerbt werden. Das Erben von einem Master oder Stil ist in der Regel besser, da Microsoft Office Visio nicht so viele Informationen speichern muss. Im ShapeSheet-Fenster werden Zellen mit lokalen Werten blau und Zellen mit geerbten Werten schwarz angezeigt. Verwenden Sie die IsInherited-Eigenschaft , um zu bestimmen, ob eine Zelle geerbt wird.

Beispiel

Dieses VBA-Makro (Microsoft Visual Basic für Applikationen) veranschaulicht, wie die RowCount-Eigenschaft zum Suchen der Anzahl von ShapeSheet-Zeilen verwendet wird, die durchlaufen werden müssen.

Öffnen Sie zum Ausführen dieses Makro eine leere Zeichnung und die Schablone Computer und Monitore, und fügen Sie dann ein Benutzerformular ein, das eine Bezeichnung, ein Text- und ein Listenfeld enthält. Legen Sie die Breite des Listenfelds auf 150 fest.

Hinweis

Die Schablone Computer und Monitore ist nur in Microsoft Office Visio Professional verfügbar.

 
Public Sub RowCount_Example() 
 
 Dim vsoStencil As Visio.Document 
 Dim vsoMaster As Visio.Master 
 Dim vsoPages As Visio.Pages 
 Dim vsoPage As Visio.Page 
 Dim vsoShape As Visio.Shape 
 Dim vsoCell As Visio.Cell 
 Dim intRows As Integer 
 Dim intCounter As Integer 
 
 'Get the Pages collection for the document. 
 'ThisDocument refers to the current document. 
 Set vsoPages = ThisDocument.Pages 
 
 'Get a reference to the first page of the Pages collection. 
 Set vsoPage = vsoPages(1) 
 
 'Get the Document object for the stencil. 
 Set vsoStencil = Documents("COMPS_U.VSS") 
 
 'Get the Master object for the desktop PC shape. 
 Set vsoMaster = vsoStencil.Masters("PC") 
 
 'Drop the shape in the approximate middle of the page. 
 'Coordinates passed to the Drop method are always in inches. 
 'The Drop method returns a reference to the new shape object. 
 Set vsoShape = vsoPage.Drop(vsoMaster, 4.25, 5.5) 
 
 'This example shows two methods of extracting custom 
 'properties. The first method retrieves the value of a custom 
 'property by name. 
 'Note that Prop.Manufacturer implies Prop.Manufacturer.Value. 
 Set vsoCell = vsoShape.Cells("Prop.Manufacturer") 
 
 'Get the cell value as a string 
 'and put it into the text box on the form. 
 UserForm1.TextBox1.Text = vsoCell.ResultStr(Visio.visNone) 
 
 'Set the caption of the label. 
 UserForm1.Label1.Caption = "Prop.Manufacturer" 
 
 'The second method of accessing custom properties uses 
 'section, row, cell. This method is best when you want 
 'to iterate through all the properties. 
 intRows = vsoShape.RowCount(Visio.visSectionProp) 
 
 'Make sure the list box is cleared. 
 UserForm1.ListBox1.Clear 
 
 'Loop through all the rows and add the value of Prop.Manufacturer 
 'to the list box. Rows are numbered starting with 0. 
 For intCounter = 0 To intRows - 1 
 Set vsoCell = vsoShape.CellsSRC(Visio.visSectionProp, intCounter, visCustPropsValue) 
 UserForm1.ListBox1.AddItem vsoCell.LocalName & vbTab & _ 
 vsoCell.ResultStr(Visio.visNone) 
 Next intCounter 
 
 'Display the user form. 
 UserForm1.Show 
 
End Sub

Support und Feedback

Haben Sie Fragen oder Feedback zu Office VBA oder zu dieser Dokumentation? Unter Office VBA-Support und Feedback finden Sie Hilfestellung zu den Möglichkeiten, wie Sie Support erhalten und Feedback abgeben können.