Compartir a través de


Propiedad Shape.RowCount (Visio)

Devuelve el número de filas de una sección ShapeSheet. Solo lectura.

Sintaxis

expresión. RowCount( _Section_ )

Expresión Variable que representa un objeto Shape .

Parameters

Nombre Obligatorio/opcional Tipo de datos Descripción
Section Obligatorio Integer Sección cuyas filas se deben contar.

Valor devuelto

Entero

Comentarios

El argumento Section debe ser una constante de sección. Si desea obtener una lista de las constantes de sección, vea el método AddSection.

Utilice la propiedad RowCount principalmente con secciones que contengan un número variable de filas, como las secciones de geometría y de puntos de conexión. Para las secciones que tienen un número fijo de filas, la propiedad RowCount devuelve el número de filas de la sección que tiene al menos una celda cuyo valor es local para la forma, a diferencia de las filas cuyas celdas se han heredado de un patrón o un estilo. Generalmente, la herencia de un patrón o un estilo es mejor debido a que Microsoft Office Visio no necesita almacenar tanta información. En la ventana ShapeSheet, las celdas con valores locales aparecen en azul, y las celdas con valores heredados aparecen en negro. Use la propiedad IsInherited para determinar si se hereda una celda.

Ejemplo:

Esta macro de Microsoft Visual Basic para Aplicaciones (VBA) muestra cómo utilizar la propiedad RowCount para determinar el número de filas de ShapeSheet que se deben recorrer en iteración.

Para ejecutar esta macro, abra un dibujo en blanco y la galería de símbolos Equipos y monitores (unidades de EE.UU.) y, a continuación, inserte un formulario de usuario que contenga una etiqueta, un cuadro de texto y un cuadro de lista. Establezca el ancho del cuadro de lista en 150.

Nota:

La galería de símbolos Equipos y monitores (unidades de EE.UU.) sólo está disponible en Microsoft Office Visio Professional.

 
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

Soporte técnico y comentarios

¿Tiene preguntas o comentarios sobre VBA para Office o esta documentación? Vea Soporte técnico y comentarios sobre VBA para Office para obtener ayuda sobre las formas en las que puede recibir soporte técnico y enviar comentarios.