I was using the statement
Sheets("GEN").Shapes("Rounded Rectangle 5").TextFrame.Characters.Text = "NOLOG"
to change the text of a Rounded Rectangle on a worksheet. After coding, I was able to click the rectangle and cycle through various values (it toggles from NOLOG to TERSE to FULL and back)
Then I fired off a subroutine that loops through checking values every minute or so.THROUGH AN ERROR:
While the subroutine was looping, I clicked on the box to change the box text value and immediately EXCEL stopped, with an error:
"Unable to set the text property of the characters class"
It continues with this error perpetually.
Any one have any thoughts as to why it would stop working if clicked while a subroutine was running?
Code snippet:
If Sheets("GEN").Range("B2") < 12 Then Sheets("GEN").Range("B2") = 12 'Initialize flags
' MsgBox Application.Caller
If Sheets("GEN").Range("B2") Mod 10 = 1 Then
Sheets("GEN").Shapes("Rounded Rectangle 5").TextFrame.Characters.Text = "NOLOG"
Sheets("GEN").Shapes("Rounded Rectangle 5").Fill.ForeColor.SchemeColor = 4 ' blue
Sheets("GEN").Range("B2") = Sheets("GEN").Range("B2").Value + 1
ElseIf Sheets("GEN").Range("B2") Mod 10 = 2 Then
Sheets("GEN").Shapes("Rounded Rectangle 5").TextFrame.Characters.Text = "TERSE"
Sheets("GEN").Shapes("Rounded Rectangle 5").Fill.ForeColor.SchemeColor = 6 ' pink
Sheets("GEN").Range("B2") = Sheets("GEN").Range("B2").Value + 1
ElseIf Sheets("GEN").Range("B2") Mod 10 = 3 Then
Sheets("GEN").Shapes("Rounded Rectangle 5").TextFrame.Characters.Text = "FULL"
Sheets("GEN").Shapes("Rounded Rectangle 5").Fill.ForeColor.SchemeColor = 8 ' red
Sheets("GEN").Range("B2") = Sheets("GEN").Range("B2").Value - 2
End If
Any help is greatly appreciated!
Sheets("GEN").Shapes("Rounded Rectangle 5").TextFrame.Characters.Text = "NOLOG"
to change the text of a Rounded Rectangle on a worksheet. After coding, I was able to click the rectangle and cycle through various values (it toggles from NOLOG to TERSE to FULL and back)
Then I fired off a subroutine that loops through checking values every minute or so.THROUGH AN ERROR:
While the subroutine was looping, I clicked on the box to change the box text value and immediately EXCEL stopped, with an error:
"Unable to set the text property of the characters class"
It continues with this error perpetually.
Any one have any thoughts as to why it would stop working if clicked while a subroutine was running?
Code snippet:
If Sheets("GEN").Range("B2") < 12 Then Sheets("GEN").Range("B2") = 12 'Initialize flags
' MsgBox Application.Caller
If Sheets("GEN").Range("B2") Mod 10 = 1 Then
Sheets("GEN").Shapes("Rounded Rectangle 5").TextFrame.Characters.Text = "NOLOG"
Sheets("GEN").Shapes("Rounded Rectangle 5").Fill.ForeColor.SchemeColor = 4 ' blue
Sheets("GEN").Range("B2") = Sheets("GEN").Range("B2").Value + 1
ElseIf Sheets("GEN").Range("B2") Mod 10 = 2 Then
Sheets("GEN").Shapes("Rounded Rectangle 5").TextFrame.Characters.Text = "TERSE"
Sheets("GEN").Shapes("Rounded Rectangle 5").Fill.ForeColor.SchemeColor = 6 ' pink
Sheets("GEN").Range("B2") = Sheets("GEN").Range("B2").Value + 1
ElseIf Sheets("GEN").Range("B2") Mod 10 = 3 Then
Sheets("GEN").Shapes("Rounded Rectangle 5").TextFrame.Characters.Text = "FULL"
Sheets("GEN").Shapes("Rounded Rectangle 5").Fill.ForeColor.SchemeColor = 8 ' red
Sheets("GEN").Range("B2") = Sheets("GEN").Range("B2").Value - 2
End If
Any help is greatly appreciated!