spacebouncer
Board Regular
- Joined
- Feb 7, 2014
- Messages
- 109
Hi! Can you help?! I thought I was getting the hang of things, perhaps I'm tired!
I've written a little code just to toggle a box between two states. The first code I tried didn't work, the second does. It would be a great if anyone could explain why the first routine doesn't work. Thanks
I've written a little code just to toggle a box between two states. The first code I tried didn't work, the second does. It would be a great if anyone could explain why the first routine doesn't work. Thanks
Code:
'''''''''''''''''''''''''''''''''''''''''''''''''
'''' Recommend HW routines
'''''''''''''''''''''''''''''''''''''''''''''''''
Sub recommendhw1()
'TODO will set a HW task
'Currently toggles between the two states
Dim selectedshape As Shape
Set selectedshape = Sheets("Seating Plans").Shapes(Application.Caller)
If selectedshape.TextFrame.Characters.Text = "Recommend Task" Then
With selectedshape
.TextFrame.Characters.Text = "Task Recommended"
.Fill.ForeColor.RGB = RGB(119, 147, 60)
End With
End If
If selectedshape.TextFrame.Characters.Text = "Task Recommended" Then
With selectedshape
.TextFrame.Characters.Text = "Recommend Task"
.Fill.ForeColor.RGB = RGB(128, 100, 162)
End With
End If
End Sub
Sub recommendmyhw1()
'TODO will set a HW task
'Currently toggles between the two states
Dim selectedshape As Shape
Set selectedshape = Sheets("Seating Plans").Shapes(Application.Caller)
If selectedshape.TextFrame.Characters.Text = "Recommend Task" Then
With selectedshape
.TextFrame.Characters.Text = "Task Recommended"
.Fill.ForeColor.RGB = RGB(119, 147, 60)
End With
Else
If selectedshape.TextFrame.Characters.Text = "Task Recommended" Then
With selectedshape
.TextFrame.Characters.Text = "Recommend Task"
.Fill.ForeColor.RGB = RGB(128, 100, 162)
End With
Else: Exit Sub
End If
End If
End Sub