Propriété Shape.GeometryCount (Visio)
Renvoie le nombre de sections Geometry d'une forme. En lecture seule.
Syntaxe
expression. GeometryCount
Expression Variable qui représente un objet Shape .
Valeur renvoyée
Entier
Exemple
Cette macro Microsoft Visual Basic pour Applications (VBA) indique comment utiliser la propriété GeometryCount pour déterminer le nombre de sections Geometry qu'a une forme.
Pour exécuter cette macro, insérez d'abord dans votre projet un formulaire utilisateur contenant une zone de liste. Utilisez les noms par défaut pour le formulaire et la zone de liste. Dans la fenêtre Propriétés, réglez la largeur du formulaire sur 400 et celle de la zone de liste sur 300. Cette macro implique également qu'une ou plusieurs formes se trouvent sur la page active.
Public Sub GeometryCount_Example()
Dim vsoShape As Visio.Shape
Dim intCurrentGeometrySection As Integer
Dim intCurrentGeometrySectionIndex As Integer
Dim intRows As Integer
Dim intCells As Integer
Dim intCurrentRow As Integer
Dim intCurrentCell As Integer
Dim intSections As Integer
'Get the first shape from the active page.
Set vsoShape = ActivePage.Shapes(1)
'Clear the list box.
UserForm1.ListBox1.Clear
'Get the count of Geometry sections in the shape.
'(If the shape is a group, this will be 0.)
intSections = vsoShape.GeometryCount
'Iterate through all Geometry sections for the shape.
'Because we are adding the current Geometry section index to
'the constant visSectionFirstComponent, we must start with 0.
For intCurrentGeometrySectionIndex = 0 To intSections - 1
'Set a variable to use when accessing the current
'Geometry section.
intCurrentGeometrySection = visSectionFirstComponent + intCurrentGeometrySectionIndex
'Get the count of rows in the current Geometry section.
intRows = vsoShape.RowCount(intCurrentGeometrySection)
'Loop through the rows. The count is zero-based.
For intCurrentRow = 0 To (intRows - 1)
'Get the count of cells in the current row.
intCells = vsoShape.RowsCellCount(intCurrentGeometrySection, intCurrentRow)
'Loop through the cells. Again, this is zero-based.
For intCurrentCell = 0 To (intCells - 1)
'Get the cell's formula and
'add it to the list box.
UserForm1.ListBox1.AddItem _
vsoShape.CellsSRC(intCurrentGeometrySection, intCurrentRow, _
intCurrentCell).LocalName & ": " & _
vsoShape.CellsSRC(intCurrentGeometrySection, intCurrentRow, _
intCurrentCell).Formula
Next intCurrentCell
Next intCurrentRow
Next intCurrentGeometrySectionIndex
'Display the user form.
UserForm1.Show
End Sub
Assistance et commentaires
Avez-vous des questions ou des commentaires sur Office VBA ou sur cette documentation ? Consultez la rubrique concernant l’assistance pour Office VBA et l’envoi de commentaires afin d’obtenir des instructions pour recevoir une assistance et envoyer vos commentaires.
Commentaires
https://aka.ms/ContentUserFeedback.
Bientôt disponible : Tout au long de 2024, nous allons supprimer progressivement GitHub Issues comme mécanisme de commentaires pour le contenu et le remplacer par un nouveau système de commentaires. Pour plus d’informations, consultezEnvoyer et afficher des commentaires pour