次の方法で共有


Cell.ResultStrU プロパティ (Visio)

汎用文字列として表されるシェイプシート セルの値を取得します。 読み取り専用です。

構文

ResultStrU (UnitsNameOrCode)

表現Cell オブジェクトを返す式。

パラメーター

名前 必須 / オプション データ型 説明
UnitsNameOrCode 必須 バリアント型 値を取得する場合に使用する単位です。

戻り値

文字列

注釈

ResultStrU プロパティの取得は、セルの Result プロパティの取得に似ています。 異なるのは、ResultStrU プロパティはセルの値として文字列を返し、Result プロパティは浮動小数点数を返す点です。

UnitsNameOrCode は、整数または文字列の値として指定できます。 文字列が無効な場合、エラーが生成されます。 たとえば、次のステートメントはすべて UnitsNameOrCode をインチに設定します。

stringReturned = Cell.ResultStrU (visInches)

stringReturned = Cell.ResultStrU (65)

stringReturned = Cell.ResultStrU ("in") 。"in" には、インチを表す任意の代替文字列 ("インチ"、"in"、"intCounter" など) を指定することもできます。

オートメーション定数 (整数値) に対応する有効な単位文字列の完全な一覧については、「単位について」を参照してください。

単位を表すオートメーション定数は、メンバー VisUnitCodes の Visio タイプ ライブラリによって宣言されます。

テキスト文字列のセルの値を取得するには、ゼロ (0) を渡します。

単位間で変換するには、 ResultStrU プロパティを使用します。 たとえば、インチで値を取得してから、その値をセンチメートルで取得できます。

ResultStrU プロパティは、編集ボックスなどのコントロールにセルの値を設定する場合に便利です。

注:

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

汎用名をプログラム内で使用すると、ソリューションをローカライズするたびに名前を変更する必要がなくなります。 ロケール固有の文字列として表現されるオブジェクトの値を取得するには、ResultStr プロパティを使用します。 汎用名として表現されるオブジェクトの値を取得するには、ResultStrU プロパティを使用します。

次の Microsoft Visual Basic for Applications (VBA) マクロは、ResultStrU プロパティを使用して、図形データ項目 (以前のカスタム プロパティ) を含むシェイプシート セルの値を取得する、2 つの方法を示します。

このマクロを実行するには、空白の図面と [基本ネットワーク図 (立体)] ステンシルを開き、ラベル、テキスト ボックス、およびリスト ボックスを含むユーザー フォームを挿入します。 リスト ボックスの幅は 150 に設定します。

注:

コンピューターとモニター (米国単位) ステンシルは、Visio Professionalでのみ使用できます。

 
Public Sub ResultStrU_Example()  
 
    Dim vsoStencil As Visio.Document  
    Dim vsoMaster As Visio.Master  
    Dim vsoPages As Visio.Pages  
    Dim vsoPage As Visio.Page  
    Dim vsoShape As Visio.Shape  
    Dim vsoCell As Visio.Cell  
    Dim intRows As Integer 
    Dim intCounter As Integer 
 
    'Get the Pages collection for the document.  
    'ThisDocument refers to the current document.  
    Set vsoPages = ThisDocument.Pages  
 
    'Get a reference to the first page of the Pages collection.  
    Set vsoPage = vsoPages(1)  
  
    'Get the Document object for the stencil.  
    Set vsoStencil = Documents("Comps_U.VSS") 
  
    'Get the Master object for the desktop PC shape.  
    Set vsoMaster = vsoStencil.Masters("PC")  
 
    'Drop the shape in the approximate middle of the page.  
    'Coordinates passed to the Drop method are always in inches.  
    'The Drop method returns a reference to the new shape object.  
    Set vsoShape = vsoPage.Drop(vsoMaster, 4.25, 5.5)  
 
    'This example shows two methods of extracting shape data 
    'The first method retrieves the value of a shape data item by name.  
    'Note that Prop.Manufacturer implies Prop.Manufacturer.Value.  
    Set vsoCell = vsoShape.Cells("Prop.Manufacturer")  
 
    'Get the cell value as a string  
    'and put it into the text box on the form.  
    UserForm1.TextBox1.Text = vsoCell.ResultStrU(Visio.visNone)  
 
    'Set the caption of the label.  
    UserForm1.Label1.Caption = "Prop.Manufacturer"  
 
    'The second method of accessing shape data uses  
    'section, row, cell. This method is best when you want  
    'to iterate through all the shape data.  
    intRows = vsoShape.RowCount(Visio.visSectionProp)  
 
    'Make sure the list box is cleared.  
    UserForm1.ListBox1.Clear  
 
    'Loop through all the rows and add the value of Prop.Manufacturer  
    'to the list box. Rows are numbered starting with 0.  
    For intCounter = 0 To intRows - 1  
        Set vsoCell = vsoShape.CellsSRC(Visio.visSectionProp, intCounter, visCustPropsValue)  
        UserForm1.ListBox1.AddItem vsoCell.LocalName & vbTab & _  
            vsoCell.ResultStrU(Visio.visNone)  
    Next intCounter  
 
    'Display the user form.  
    UserForm1.Show  
 
End Sub

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

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