Propriedade Cell.Precedents (Visio)

Retorna uma matriz de células ShapeSheet das quais depende a fórmula de outra célula. Somente leitura.

Sintaxe

mais simples. Precedentes

expressão Uma variável que representa um objeto Cell .

Valor de retorno

Cell()

Comentários

A propriedade Precedentes retorna uma matriz de células que fazem com que o objeto Cell pai recalcule seu valor quando sua fórmula ou valor é alterado.

Exemplo

A macro do Microsoft Visual Basic for Applications (VBA) a seguir mostra como usar a propriedade Precedents para exibir uma lista de células das quais depende a célula "Scratch.X1" de uma forma. A macro desenha um retângulo na página ativa, adiciona uma seção Scratch ao ShapeSheet do retângulo e, em seguida, insere uma fórmula em uma célula dessa seção que é usada para curvar os lados do retângulo para dentro, alterando cada um dos lados do retângulo para um arco. Como a fórmula usada para curvar os lados do retângulo depende da largura e da altura do retângulo, a célula que contém a fórmula, Scratch.X1, depende das células Largura e Altura da forma do retângulo, tornando essas células precedentes.

Public Sub Precedents_Example() 
 
 Dim acellPrecedentCells() As Visio.Cell 
 Dim vsoCell As Visio.Cell 
 Dim vsoShape As Visio.Shape 
 Dim strBowCell As String 
 Dim strBowFormula As String 
 Dim intCounter As Integer 
 
 'Set the value of the strBowCell string 
 strBowCell = "Scratch.X1" 
 
 'Set the value of the strBowFormula string 
 strBowFormula = "=Min(Width, Height) / 5" 
 
 'Draw a rectangle on the active page 
 Set vsoShape = ActivePage.DrawRectangle(1, 5, 5, 1) 
 
 'Add a scratch section and then 
 vsoShape.AddSection visSectionScratch 
 
 'Add a row to the scratch section 
 vsoShape.AddRow visSectionScratch, visRowScratch, 0 
 
 'Place the value of strBowFormula into Scratch.X1 
 'Set the Cell object to the Scratch.X1 and set formula 
 Set vsoCell = vsoShape.Cells(strBowCell) 
 
 'Set up the offset for the arc 
 vsoCell.Formula = strBowFormula 
 
 'Bow in or curve the original rectangle's lines by changing 
 'each row to an arc and entering the bow value 
 For intCounter = 1 To 4 
 
 vsoShape.RowType(visSectionFirstComponent, visRowVertex + intCounter) = visTagArcTo 
 Set vsoCell = vsoShape.CellsSRC(visSectionFirstComponent, visRowVertex + intCounter, 2) 
 vsoCell.Formula = "-" & strBowCell 
 
 Next intCounter 
 
 'Get the array of precedent cells 
 acellPrecedentCells = vsoShape.Cells("Scratch.X1").Precedents 
 
 'List the cell names and their associated formula 
 For intCounter = LBound(acellPrecedentCells) To UBound(acellPrecedentCells) 
 Set vsoCell = acellPrecedentCells(intCounter) 
 Debug.Print vsoCell.Name & " has this formula: " & vsoCell.Formula 
 Next 
 
End Sub

Suporte e comentários

Tem dúvidas ou quer enviar comentários sobre o VBA para Office ou sobre esta documentação? Confira Suporte e comentários sobre o VBA para Office a fim de obter orientação sobre as maneiras pelas quais você pode receber suporte e fornecer comentários.