2016-08-10 10 views
0

図形に数値が表示されているシェイプを作成する必要があります。例えば図形にすべてのテキストが表示されない

、数が1~9であることが表示されますが、10〜19のためには、私はそれが同じでなければならない半径を変更したくないだけ1

示します。

Sheets(xRiS).Select 
Dim textRectangles As Shape 
Dim radius As Integer 
radius = 15 

Set textRectangles = ActiveSheet.Shapes.AddShape(msoShapeOval, (Range("D13").Left - radius/2), _ 
    Range("D13").Top - radius/2, radius, radius) 

textRectangles.Name = "Groups " & i 
textRectangles.TextFrame.Characters.Text = i 
textRectangles.TextFrame.VerticalAlignment = xlVAlignCenter 
textRectangles.TextFrame.HorizontalAlignment = xlHAlignCenter 
textRectangles.TextFrame.Characters.Font.Size = 9 
textRectangles.TextFrame.Characters.Font.Name = "Georgia" 
textRectangles.Fill.ForeColor.RGB = RGB(220, 105, 0) 
textRectangles.Fill.Transparency = 0.5 

これは、現在の結果である:私は数を表示するように形状を設定するにはどうすればよい

enter image description here

:これは私が望む結果である

enter image description here

番号は10-19ですか?

+1

テキストの整列プロパティをMiddle Centeredに変更します(まだない場合)。フォントサイズを調整する必要があります。 –

+0

in textRectangles.TextFrameどのように私は中心に中央にすることができます、サイズは9ですので、私は5を置く場合、それは読むことができません – BKChedlia

+0

*どのように私は中心に中央にすることができます*それを行う方法のアイデアを得るためにマクロレコーダーを使用する? –

答えて

0

理論的な選択肢がいくつかありますが、どちらもradius = 15textRectangles.TextFrame.Characters.Font.Size = 9で動作しないようです。

最初は​​で、テキストを修正するために図形のサイズを変更しますが、これはradiusを大幅に拡張します。

第2はtextRectangles.TextFrame2.AutoSize = msoAutoSizeTextToFitShapeですが、これは最小値がradius = 33の場合のみ有効です。

半径を大きくすることを検討する必要があります。

+0

半径は最小にして、変更しないでください。私が多くのポイントを持っているなら、33は大きいです – BKChedlia

+0

はい - すべての設定のために '.TextFrame2.AutoSize = msoAutoSizeTextToFitShape'がうまく動作しません:( –

関連する問題