Dim bln As Boolean
Private Sub Image1_MouseMove( _
ByVal Button As Integer, _
ByVal Shift As Integer, _
ByVal X As Single, _
ByVal Y As Single)
Call ChangeImage(Image1, X, Y)
End Sub
Private Sub ChangeImage(img As Control, X As Single, Y As Single)
Dim sPath As String, sPctA As String, sPctB As String
sPath = ThisWorkbook.Path & "\"
If img.Name = "Image2" Then
sPctA = sPath & "prev_button.gif"
sPctB = sPath & "prev_button_on.gif"
Else
sPctA = sPath & "next_button.gif"
sPctB = sPath & "next_button_on.gif"
End If
If bln = False Then
If X > 2 And Y > 2 And X < 16 And Y < 16 Then
img.Picture = LoadPicture(sPctA)
Else
img.Picture = LoadPicture(sPctB)
bln = False
End If
Me.Repaint
End If
End Sub
Private Sub Image1_Click()
bln = False
Image1.Picture = LoadPicture(ThisWorkbook.Path & "\prev_button_on.gif")
Label1.Caption = CLng(Label1.Caption) + 1
Me.Repaint
End Sub