I have a userform with multiple elements.

An example for changing the background of the control button upon mouse hovering. But for each button I need to define the predefined Button_MouseMove(....) function.

I would like to have a single function which takes control object as argument for any the control objects.

For example.

I am currently using this procedure

Private Sub btnrefresh_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
    If Me.btnrefresh.Enabled = True Then Me.btnrefresh.BackColor = &H9CED4B
End Sub

But I need some procedure looks like this

Public sub Any_Button_MouseHovering(Byval Button as object)
    if (coordinates of mouse falls inside the button area) then    'I need to know procedure for this also
        If button.Enabled = True Then Button.BackColor = &H9CED4B
    else
        Button.BackColor = vbWhite
    end if
end sub
0

There are 0 best solutions below