2016-12-08 4 views
0

矢印があり、クリックすると雲の形が現れます。これは今では問題なく動作します。私が今したいのは、同じボタンをもう一度クリックするとクラウドが消えてしまうことです。私は私が私の雲のオブジェクトを作成する必要があり、その状態または何かのためとして、私は、これは私のコードであるかはまだ..把握didntはgues:同じ「ボタン」で図形を開いて閉じます

サブバブル()

ActiveSheet.Shapes.AddShape(msoShapeCloudCallout, 795, 8.25, 107.25, 41.25). _ 
     Select 
    Selection.ShapeRange.Adjustments.Item(1) = -0.25029 
    Selection.ShapeRange(1).TextFrame2.TextRange.Characters.Text = "text..." 
    With Selection.ShapeRange(1).TextFrame2.TextRange.Characters(1, 10). _ 
     ParagraphFormat 
     .FirstLineIndent = 0 
     .Alignment = msoAlignLeft 
    End With 
    With Selection.ShapeRange(1).TextFrame2.TextRange.Characters(1, 10).Font 
     .NameComplexScript = "+mn-cs" 
     .NameFarEast = "+mn-ea" 
     .Fill.Visible = msoTrue 
     .Fill.ForeColor.ObjectThemeColor = msoThemeColorLight1 
     .Fill.ForeColor.TintAndShade = 0 
     .Fill.ForeColor.Brightness = 0 
     .Fill.Transparency = 0 
     .Fill.Solid 
     .Size = 11 
     .Name = "+mn-lt" 
    End With 
    Range("P5").Select 

End Subの

答えて

0

は考えてみましょう:

文字列

として暗いSHP
Sub Bubble() 

    ActiveSheet.Shapes.AddShape(msoShapeCloudCallout, 795, 8.25, 107.25, 41.25). _ 
     Select 

    shp = Selection.Name 
    Selection.ShapeRange.Adjustments.Item(1) = -0.25029 
    Selection.ShapeRange(1).TextFrame2.TextRange.Characters.Text = "text.................." 
    With Selection.ShapeRange(1).TextFrame2.TextRange.Characters(1, 10). _ 
     ParagraphFormat 
     .FirstLineIndent = 0 
     .Alignment = msoAlignLeft 
    End With 
    With Selection.ShapeRange(1).TextFrame2.TextRange.Characters(1, 10).Font 
     .NameComplexScript = "+mn-cs" 
     .NameFarEast = "+mn-ea" 
     .Fill.Visible = msoTrue 
     .Fill.ForeColor.ObjectThemeColor = msoThemeColorLight1 
     .Fill.ForeColor.TintAndShade = 0 
     .Fill.ForeColor.Brightness = 0 
     .Fill.Transparency = 0 
     .Fill.Solid 
     .Size = 11 
     .Name = "+mn-lt" 
    End With 
    Range("P5").Select 
End Sub 

Sub FlipFlop() 
    With ActiveSheet.Shapes(shp) 
     .Visible = Not .Visible 
    End With 
End Sub 

We のコールアウトBubble()コードを少し変更してください。矢印シェイプにFlipFlop()コードを割り当てます。

矢印をクリックするたびに、吹き出しが表示と非表示の間で切り替わります。

EDIT#1:

私の代わりに

the problem. Remove the old code and use: 

Sub Bubble2() 

    ActiveSheet.Shapes.AddShape(msoShapeCloudCallout, 795, 8.25, 107.25, 41.25). _ 
     Select 

    Selection.Name = "zooky" 
    Selection.ShapeRange.Adjustments.Item(1) = -0.25029 
    Selection.ShapeRange(1).TextFrame2.TextRange.Characters.Text = "text.................." 
    With Selection.ShapeRange(1).TextFrame2.TextRange.Characters(1, 10). _ 
     ParagraphFormat 
     .FirstLineIndent = 0 
     .Alignment = msoAlignLeft 
    End With 
    With Selection.ShapeRange(1).TextFrame2.TextRange.Characters(1, 10).Font 
     .NameComplexScript = "+mn-cs" 
     .NameFarEast = "+mn-ea" 
     .Fill.Visible = msoTrue 
     .Fill.ForeColor.ObjectThemeColor = msoThemeColorLight1 
     .Fill.ForeColor.TintAndShade = 0 
     .Fill.ForeColor.Brightness = 0 
     .Fill.Transparency = 0 
     .Fill.Solid 
     .Size = 11 
     .Name = "+mn-lt" 
    End With 
    Range("P5").Select 
End Sub 

Sub FlipFlop2() 
    With ActiveSheet.Shapes("zooky") 
     .Visible = Not .Visible 
    End With 
End Sub 

を見つけました。

+0

これを行うと、シートが空になります。D – zooky

+0

@zこれをクリーンシートで繰り返します。 –

+0

@zooky私の** EDIT#1 ** –

関連する問題