Disabling mouse scrolling issue

  • Thread starter Thread starter Mr.Kane
  • Start date Start date
M

Mr.Kane

I am attempting to use Microsoft's KB instrucitons to disable mouse
scrolling in a form.

after adding the following code to the module of the form:

Option Compare Database
Option Explicit

Private WithEvents clsMouseWheel As MouseWheel.CMouseWheel

Private Sub Form_Load()
Set clsMouseWheel = New MouseWheel.CMouseWheel
Set clsMouseWheel.Form = Me
clsMouseWheel.SubClassHookForm
End Sub

Private Sub Form_Close()
clsMouseWheel.SubClassUnHookForm
Set clsMouseWheel.Form = Nothing
Set clsMouseWheel = Nothing
End Sub

Private Sub clsMouseWheel_MouseWheel(Cancel As Integer)
MsgBox "You cannot use the mouse wheel to scroll records."
Cancel = True
End Sub



I received the following error: Compile Error: Invalid Attribute or Sub
Function
with the following code highlighted: WithEvents clsMouseWheel As
MouseWheel.CMouseWheel

Any help would be appreciated.
I know that many have solved this issue but I've been working on this
for several hours and just need the obvious solution

Thank you
Marc Kane
 
Back
Top