Cell.Precedents プロパティ (Visio)

別のセルの数式が依存するシェイプシート セルの配列を返します。 読み取り専用です。

構文

Precedents

Cell オブジェクトを表す変数。

戻り値

Cell()

注釈

Precedents プロパティは、数式または値が変更されたときに親セル オブジェクトの値を再計算する原因となるセルの配列を返します。

次の Microsoft Visual Basic for Applications (VBA) マクロは、Precedents プロパティを使用して、図形の "Scratch.X1" セルが依存するセルの一覧を表示する方法を示しています。 このマクロは、アクティブなページに四角形を描画し、四角形のシェイプシートにスクラッチ セクションを追加してから、四角形の辺を円弧に変更することで、四角形の辺を内側に曲げるために使用されるセクションのセルに数式を入力します。四角形の辺を曲げるために使用される数式は、四角形の幅と高さに依存するため、数式 Scratch.X1 を含むセルは、四角形の図形の幅と高さのセルに依存し、これらのセルを先行セルにします。

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

サポートとフィードバック

Office VBA またはこの説明書に関するご質問やフィードバックがありますか? サポートの受け方およびフィードバックをお寄せいただく方法のガイダンスについては、Office VBA のサポートおよびフィードバックを参照してください。