次の方法で共有


Cell.FormulaU プロパティ (Visio)

Cell オブジェクトの汎用構文式を取得または設定します。 値の取得と設定が可能です。

構文

FormulaU

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

戻り値

文字列

注釈

セルの数式が GUARD 関数で保護されている場合、セルの数式を変更するには FormulaForceU プロパティを使用する必要があります。

注:

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

汎用名をプログラム内で使用すると、ソリューションをローカライズするたびに名前を変更する必要がなくなります。 セルの数式文字列をローカル構文で取得する場合、またはローカル構文と汎用構文の両方を使用してセルの数式を設定する場合は Formula プロパティを使用してます。 数式を汎用構文出取得または解析する場合は、FormulaU プロパティを使用します。 FormulaU を使用する場合、小数点は常に "."、桁区切り記号は常に "," で、汎用単位文字列を使用する必要があります (汎用文字列の詳細については、「単位について」を参照してください)。

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

  • Microsoft.Office.Interop.Visio.IVCell.FormulaU

次の Microsoft Visual Basic for Applications (VBA) マクロは、FormulaU プロパティを使用してシェイプシート セルの数式を設定する方法を示しています。 ページ上に長方形を描画し、直線を円弧に変更し長方形の辺を曲線にします。 この長方形の湾曲した各辺の内側に長方形を描画します。

 
Public Sub FormulaU_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.FormulaU = 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.FormulaU = "-" & 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.FormulaU = "Width * 0 + " & strBowCell  
    Set vsoCell = vsoShape.CellsSRC(intIndex, 1, 1)  
    vsoCell.FormulaU = "Height * 0 + " & strBowCell  
 
    'Draw the inner rectangle bottom line. 
    Set vsoCell = vsoShape.CellsSRC(intIndex, 2, 0)  
    vsoCell.FormulaU = "Width * 1 - " & strBowCell  
    Set vsoCell = vsoShape.CellsSRC(intIndex, 2, 1)  
    vsoCell.FormulaU = "Height * 0 + " & strBowCell  
 
    'Draw the inner rectangle right side line. 
    Set vsoCell = vsoShape.CellsSRC(intIndex, 3, 0)  
    vsoCell.FormulaU = "Width * 1 - " & strBowCell  
    Set vsoCell = vsoShape.CellsSRC(intIndex, 3, 1)  
    vsoCell.FormulaU = "Height * 1 - " & strBowCell  
 
    'Draw the inner rectangle top line. 
    Set vsoCell = vsoShape.CellsSRC(intIndex, 4, 0)  
    vsoCell.FormulaU = "Width * 0 + " & strBowCell  
    Set vsoCell = vsoShape.CellsSRC(intIndex, 4, 1)  
    vsoCell.FormulaU = "Height * 1 - " & strBowCell  
 
    'Draw the inner rectangle left side line. 
    Set vsoCell = vsoShape.CellsSRC(intIndex, 5, 0)  
    vsoCell.FormulaU = "Geometry2.X1"  
    Set vsoCell = vsoShape.CellsSRC(intIndex, 5, 1)  
    vsoCell.FormulaU = "Geometry2.Y1"  
 
End Sub

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

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