Shape.CellsSRC プロパティ (Visio)

セクション、行、列のインデックスによって識別されるシェイプシート セルを表す Cell オブジェクトを返します。 読み取り専用です。

構文

expression. CellsSRC( _Section_ , _Row_ , _Column_ )

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

パラメーター

名前 必須 / オプション データ型 説明
Section 必須 Integer セルのセクション インデックスです。
必須 Integer セルの行インデックスです。
必須 Integer セルの列インデックスです。

戻り値

Cell

注釈

セクション、行、列のインデックスによって図形の数式にアクセスするには、CellsSRC プロパティを使用します。 セクション、行、列のインデックスの定数は、Visio タイプ ライブラリによって 、VisSectionIndicesVisRowIndicesVisCellIndices のメンバーとしてそれぞれ宣言されます。

セクション、行、列のインデックス値がセクションに応じて実際のセルを識別しない場合、 CellsSRC プロパティによって例外が発生する可能性があります。 しかし、例外が発生しなかった場合でも、返されたオブジェクトで起動した後続のメソッドは失敗します。 特定のインデックス値を持つセルが存在するかどうかを確認するには CellsSRCExists プロパティを使用します。

CellsSRC プロパティは通常、セクションまたは行のセルを反復処理するために使用されます。 1 つのセルを取得するには、 Cells プロパティを使用し、セル名を指定します。 例:

Set vsoCell = Cells("PinX")

Visual Studio ソリューションに Microsoft.Office.Interop.Visio リファレンスが含まれている場合、このプロパティは次の種類にマップされます。

  • Microsoft.Office.Interop.Visio.IVShape.get_CellsSRC

次の Microsoft Visual Basic for Applications (VBA) マクロは、CellsSRC プロパティを使用し、セクション、行、および列のインデックスに従って、特定のシェイプシート セルを設定します。 このマクロはページに長方形を描画し、この長方形の直線を円弧に変えて、四辺をカーブさせます。 次に、この曲線で描画された長方形の内側にさらに長方形を描画します。

 
Public Sub CellsSRC_Example() 
  
    Dim vsoPage As Visio.Page  
    Dim vsoShape As Visio.Shape  
    Dim vsoCell As Visio.Cell  
    Dim strBowCell As String 
    Dim strBowFormula As String 
    Dim intIndex As Integer 
    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"  
 
    Set vsoPage = ActivePage  
 
    'If there isn't an active page, set vsoPage 
    'to the first page of the active document. 
    If vsoPage Is Nothing Then 
        Set vsoPage = ActiveDocument.Pages(1)  
    End If   
 
    'Draw a rectangle on the active page. 
    Set vsoShape = vsoPage.DrawRectangle(1, 5, 5, 1)  
 
    'Add a scratch section to the shape's ShapeSheet  
    vsoShape.AddSection visSectionScratch  
 
    'Add a row to the scratch section.  
    vsoShape.AddRow visSectionScratch, visRowScratch, 0  
 
    'Set vsoCell to the Scratch.X1 cell and set its formula. 
    Set vsoCell = vsoShape.Cells(strBowCell)  
    vsoCell.Formula = strBowFormula  
 
    'Bow in or curve the rectangle's lines by changing 
    'each row type from LineTo to ArcTo 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  
 
    'Create an inner rectangle. 
    'Set the section index for the inner rectangle's Geometry section.  
    intIndex = visSectionFirstComponent + 1  
 
    'Add an inner rectangle Geometry section.  
    vsoShape.AddSection intIndex  
 
    'Add the first 2 rows to the section.  
    vsoShape.AddRow intIndex, visRowComponent, visTagComponent  
    vsoShape.AddRow intIndex, visRowVertex, visTagMoveTo 
  
    'Add 4 LineTo rows to the section 
    For intCounter = 1 To 4  
        vsoShape.AddRow intIndex, visRowLast, visTagLineTo  
    Next intCounter  
 
    'Set the inner rectangle start point cell formulas. 
    Set vsoCell = vsoShape.CellsSRC(intIndex, 1, 0)  
    vsoCell.Formula = "Width * 0 + " & strBowCell  
    Set vsoCell = vsoShape.CellsSRC(intIndex, 1, 1)  
    vsoCell.Formula = "Height * 0 + " & strBowCell  
 
    'Draw the inner rectangle bottom line. 
    Set vsoCell = vsoShape.CellsSRC(intIndex, 2, 0)  
    vsoCell.Formula = "Width * 1 - " & strBowCell  
    Set vsoCell = vsoShape.CellsSRC(intIndex, 2, 1)  
    vsoCell.Formula = "Height * 0 + " & strBowCell 
  
    'Draw the inner rectangle right side line. 
    Set vsoCell = vsoShape.CellsSRC(intIndex, 3, 0)  
    vsoCell.Formula = "Width * 1 - " & strBowCell  
    Set vsoCell = vsoShape.CellsSRC(intIndex, 3, 1)  
    vsoCell.Formula = "Height * 1 - " & strBowCell  
 
    'Draw the inner rectangle top line. 
    Set vsoCell = vsoShape.CellsSRC(intIndex, 4, 0)  
    vsoCell.Formula = "Width * 0 + " & strBowCell  
    Set vsoCell = vsoShape.CellsSRC(intIndex, 4, 1)  
    vsoCell.Formula = "Height * 1 - " & strBowCell  
 
    'Draw the inner rectangle left side line. 
    Set vsoCell = vsoShape.CellsSRC(intIndex, 5, 0)  
    vsoCell.Formula = "Geometry2.X1"  
    Set vsoCell = vsoShape.CellsSRC(intIndex, 5, 1)  
    vsoCell.Formula = "Geometry2.Y1"  
 
End Sub

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

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