Share via


Shape.CellsU プロパティ (Visio)

シェイプシート セルを表す Cell オブジェクトを返します。 読み取り専用です。

構文

CellsU( _localeIndependentCellName_ )

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

パラメーター

名前 必須 / オプション データ型 説明
localeIndependentCellName 必須 String シェイプシート セルの名前です。

戻り値

Cell

注釈

CellsU ("somestring") は、"somestring" が実際のセルに名前を付けない場合、"予期しないファイルの終わり" 例外を発生させます。 CellExistsU プロパティを使用して、ユニバーサル名 "somestring" のセルが存在するかどうかを判断します。

図形の [User-Defined Cells] および [Shape Data] セクションにあるセルは、ユーザーまたはプログラムによって名前が割り当てられた行に属しています。 CellsU プロパティを使用して、名前付き行のセルにアクセスします。

たとえば、図形の [User-Defined Cells] セクションにある行の名前が Row_1 である場合、次のステートメントを使用して、この行の先頭セル、つまり、行の名前が入っている列 0 のセルにアクセスすることができます。

vsoCell = vsoShape.CellsU("User.Row_1")

次のステートメントを使用して、Row_1のプロンプト セルにアクセスします。

vsoCell = vsoShape.CellsU("User.Row_1.Prompt")

次に、Row_1 が [User-Defined Cells] セクションではなく、[Shape Data] セクションにあるとします。 行の最初のセル (行の名前を保持する列 0 のセル) にアクセスするには、次のステートメントを使用します。

vsoCell = vsoShape.CellsU("Prop.Row_1")

行内の他のセルにアクセスするには、次のステートメントを使用します。

vsoCell = vsoShape.CellsU("Prop.Row_1.xxx ")

ここで xxx は Label、Prompt、SortKey、Type、Format、Invisible、または Ask のいずれかのセルになります。

注:

Microsoft Visio 2000 以降では、ローカル名とユニバーサル名の両方を使用して、Visio の図形、マスター、ドキュメント、ページ、行、アドオン、セル、ハイパーリンク、スタイル、フォント、マスター ショートカット、UI オブジェクト、レイヤーを参照できます。 たとえば、ユーザーが図形に名前を付けると、ユーザーはローカル名を指定します。 Microsoft Office Visio 2003 以降、シェイプシート スプレッドシートには、セルの数式と値にユニバーサル名のみが表示されます。 (以前のバージョンでは、ユニバーサル名はユーザー インターフェイスに表示されませんでした)。

汎用名をプログラム内で使用すると、ソリューションをローカライズするたびに名前を変更する必要がなくなります。 セルのローカル名を使用して Cell オブジェクトを取得するには Cells プロパティを使用します。 セルの汎用名を使用して Cell オブジェクトを取得するには CellsU プロパティを使用します。

次の Microsoft Visual Basic for Applications (VBA) マクロは、CellsU プロパティを使って、指定した汎用名を持つシェイプシート セルを取得します。 このマクロはページに長方形を描画し、この長方形の直線を円弧に変えて、四辺をカーブさせます。 このため、長方形の各辺でシェイプシートの行の種類を LineTo から ArcTo に変更し、それぞれの行で [X] セルと [Y] セルの値を変更します。

 
Public Sub CellsU_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 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 and add a row to the scratch section. 
 vsoShape.AddSection visSectionScratch 
 vsoShape.AddRow visSectionScratch, visRowScratch, 0 
 
 'Set vsoCell to the Scratch.X1 cell and set its formula. 
 Set vsoCell = vsoShape.CellsU(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 
 
End Sub

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

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