Link to home
Start Free TrialLog in
Avatar of r_johnston
r_johnston

asked on

Button Color Changes In .dotm but not .doc mode...

Hey Experts,

I have a strange issue; the following code works in a Word .dotm but doesn't work when you open the template by double left clicking (regular .doc mode).


Private Sub txtRequestor_MouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
    ToggleCounter = 1
    Counter
End Sub

'===========================================================================================

Sub Counter() 'Toggles cmdStartRequest color every one second via "ColorToggle" sub
    Application.OnTime Now() + TimeValue("00:00:01"), "ColorToggle"
End Sub

'===========================================================================================

Sub ColorToggle() 'Toggles cmdStartRequest background color
    If ToggleCounter = 5 Then
        Exit Sub
    Else
        If cmdStartRequest.BackColor = 3158271 Then
            cmdStartRequest.BackColor = 65280 'Green
        Else
            cmdStartRequest.BackColor = 3158271 'Red
        End If
        ToggleCounter = ToggleCounter + 1
        Counter
    End If
End Sub

'===========================================================================================

Open in new window


The ToggleCounter variable is located in a Module as a Byte.

Change the file extension to .dotm

Any thoughts?
ASKER CERTIFIED SOLUTION
Avatar of GrahamSkan
GrahamSkan
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of r_johnston
r_johnston

ASKER

That did it! I would have never thought I would have had that issue...sheesh...
Thanks!