bubastisbastet
New Member
- Joined
- Oct 11, 2008
- Messages
- 11
Hi All,
I am trying to write VB to enable the text on a macro button to briefly flash red when the button is pressed, and then return to the default white color thereafter (as a means for a user to get an indication that pressing the button actually 'did something').
My code is as follows:
oddly, this code only reverts to the second defined color (colorindex = 2), but will not cycle between the two.
however, the following code, when applied to text within a cell (A1 in this instance), DOES work:
Any suggestions as to why it won't work when applied to text within a shape?
Many thanks!!
I am trying to write VB to enable the text on a macro button to briefly flash red when the button is pressed, and then return to the default white color thereafter (as a means for a user to get an indication that pressing the button actually 'did something').
My code is as follows:
Code:
Sub test()
Dim x As Single
x = Timer
With ActiveSheet
.Shapes("AutoShape 109").TextFrame.Characters.Font.ColorIndex = 3
While Timer - x < 0.5
Wend
.Shapes("AutoShape 109").TextFrame.Characters.Font.ColorIndex = 2
End With
End Sub
however, the following code, when applied to text within a cell (A1 in this instance), DOES work:
Code:
Sub test2()
Dim x As Single
x = Timer
With ActiveSheet
.Range("a1").Font.ColorIndex = 3
While Timer - x < 0.5
Wend
.Range("a1").Font.ColorIndex = 2
End With
End Sub
Many thanks!!