NumberCrunchingMonky
Technical User
I have some script that changes the visual effect of three buttons upon mouse-over, but the 7th line from the bottom highlights yellow during the event, indicating an issue. I do not know what is causing this.
Here's the line:
Set OleObj = Me.OLEObjects("Label" & i)
Here's the script in full:
Private Sub commandbutton1_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
Normalize
Label1.BackColor = 16777164
Label1.SpecialEffect = fmSpecialEffectSunken
'Do whatever else . . .
End Sub
Private Sub commandbutton2_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
Normalize
Label2.BackColor = 16777164
Label2.SpecialEffect = fmSpecialEffectSunken
'Do whatever else . . .
End Sub
Private Sub commandbutton3_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
Normalize
Label3.BackColor = 16777164
Label3.SpecialEffect = fmSpecialEffectSunken
'Do whatever else . . .
End Sub
Private Sub Normalize()
Dim i As Long, OleObj As OLEObject
For i = 1 To 3
Set OleObj = Me.OLEObjects("Label" & i)
With OleObj.Object
.SpecialEffect = fmSpecialEffectRaised
.BackColor = vbMenuBar
End With
Next
End Sub
Thanks for your help.
NCM
Here's the line:
Set OleObj = Me.OLEObjects("Label" & i)
Here's the script in full:
Private Sub commandbutton1_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
Normalize
Label1.BackColor = 16777164
Label1.SpecialEffect = fmSpecialEffectSunken
'Do whatever else . . .
End Sub
Private Sub commandbutton2_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
Normalize
Label2.BackColor = 16777164
Label2.SpecialEffect = fmSpecialEffectSunken
'Do whatever else . . .
End Sub
Private Sub commandbutton3_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
Normalize
Label3.BackColor = 16777164
Label3.SpecialEffect = fmSpecialEffectSunken
'Do whatever else . . .
End Sub
Private Sub Normalize()
Dim i As Long, OleObj As OLEObject
For i = 1 To 3
Set OleObj = Me.OLEObjects("Label" & i)
With OleObj.Object
.SpecialEffect = fmSpecialEffectRaised
.BackColor = vbMenuBar
End With
Next
End Sub
Thanks for your help.
NCM