Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    Visual Basic

See Related Forum Messages: Follow the Links Below to View Complete Thread

How To Disable Mouse Scroll Wheel In VBA Access 2000
How do I programmatically disable the mouse scroll wheel
in Access 2000 using Visual Basic for Applications?

Thank you in advance for your help.

Way To Disable Scroll When Using Wheel?
I am using a listbox to hold the names of items that have pictures associated with them. I am able to display the picture when the middle button is pushed and hide the picture when the middle button is let up except when the listbox grows to the point where a scrollbar is visible. When the scrollbar is visible, it is a crap shoot whether my sub will work or whether the listbox will scroll up and down per the default function of the middle button.

A search here came up with a couple of hits but no solutions. Any new information somebody has for this issue? TIA


Mouse Scroll Wheel Vs Vertical Scroll Bar
Right then i have a small problem.

I have a VScrollBar which scrols the contents of a custom picture box, how do i make the scroll bar scroll when the mouse wheel is moved?

Cheers people

Scroll Bar And The Mouse Wheel
I have set up an image control inside a picture box.
the picture box is in a tab strip and I have attached a scroll bar to the side of the tab strip.

Now I control the scrolling of the image with the scroll bar and everything works fine.

There was just one thing I wanted to be abe to do.

Right now, in order to scroll with the wheel on a mouse the mouse has to be positioned over the scroll bars.

Is there a way I can associate the scroll bar with the image control so that when someone has the mouse over the image, scrolling with the wheel will cause the scroll bars to move???

Thanks guys

Need Help With Mouse Scroll Wheel
Hi all,
I'm at a very basic level so wish you could keep your answers as clear as possible.
I'm a slotcar fan and would like to build something that allows an easy reading of the number of revolutions (rph) of my electric motors.
Was thinking about using the mouse scroll wheel.
Have made a search in this site and found some pretty easy code that uses WM_MOUSEWHEEL but, due to my lack of knowledge, I'm still missing a way to understand how to know when the wheel has completed 1 turn.
Anybody could please help, maybe with a basic code sample ?
Thanks in advance,

Using Mouse Scroll-Wheel In VB6.0?
Is there an update or script that I can download somewhere that will allow the scroll-wheel on my mouse to scroll through code in Visual Basic 6.0.. I have gotten use to using the scroll-wheel in applications like Dreamweaver, Notepad and just about every other application the has multiple line text boxes.. It would help me alot to be able to scroll up and down applications this way. Plz help.


Mouse Wheel Scroll NOT In IDE

My scroll works fine in the VB IDE but not when I run the program. I know about VBScroll, but I'm hoping there is another way of having scrolling functionality that I can deploy with my program. I don't want to install an extra program on all machines that run my program just to get scroll to work.


Mouse Scroll Wheel
I know this question was asked. But I could not handle the code given there.

Here is my question (and the answer must be directly):
How do I set the Mouse Scroll Wheel to work with a ScrollBar.

That's all I need, so PLEASE PLEASE PLEASE answer JUST for that.

Thank you

Wheel Mouse Scroll
I have a slider in one of my projects that seems to automaticlly work with a Wheel Mouse which is nice.

I have already written code to check to see if there is a Wheel Mouse installed but now I need to determine wheather or not the user is using the wheel to scroll the Slider in the Slider1_scroll event.

Does anyone know how to determine if a user is using a wheel mouse to scroll a slider as opposed to just dragging it?

Scroll With Mouse Wheel?
Sorry, but I cannot help.

If you get a reply, please let me know, this code would be very useful. (

Vb6: Mouse Scroll Wheel?
is there a way to detect if the mouse scroll wheel is scrolling, and in which direction?
in the program i'm working on I don't have any real "controls" i just have a picture box on which I'm painting various virtual controls. there are some virtual list boxes which I'd like to be able to scroll through with the scroll wheel but without being able to detect it, I can't program it.

Mouse Scroll Wheel
Ok, I'm probably an idiot for not knowing, but when you scroll with the wheel on your mouse while a form is open in Access 2000, instead of scrolling up and down the scroll bar, it scrolls through records.

This is DRIVING ME NUTS! Granted, it's a short drive. Still, anyone know how to make the mouse wheel control the scroll bar instead of traversing through records in the form?? Or in the very least make it do nothing at all.

Thanks in advance,


Edited by - LordRaiden on 1/13/2004 6:41:04 PM

How Do I Disable The Mouse Wheel?
Here's the problem. I have Access 97, and I'm using a subform. The mouse scroll unfortunately navigates the records in the subform. I want to stop it from doing so. I have reviewed some of the previous API, but the code module/class module (tried them both) doesn't like the AddressOf keyword.

Does anyone have any good to post that will work in this scenario?



How To Disable Mouse Wheel?
  I am trying to find some code to disable mouse wheel.

  Can somebody give me some hint?

Disable Mouse Wheel..?
I have come across a couple of methods to disable the mouse wheel in access using vba, but is there a simpler way? I mean microsoft gives this totally bogus super error prone highly volatile method that involves adding a lot of code. Actually they give another method, but I don't have access (get it? access ) to VB6 where I work, and that method itself is long and drawn out.

I came across another method... which really isn't disabling it... it's just walking around the problem, where instead of using bound controls, you do all the lookup functionality yourself.

Now, I'm sure that the last method would be fine, but the problem is that I already have this monstrosity built that I don't want to have to rewrite by hand.

I also found another method which involved downloading MsgHook, and I wouldn't mind using that method if someone could tell me how to redistribute it. I don't have the developer's edition of access, so I can't just stick it in as part of the .exe...

Does anyone have a simple way to disable the mouse or can tell me how to distribute easily MsgHook?

-sleepless in seattle (j/k)

- one_eye

Edited by - cyclops_one_eye on 7/7/2004 10:01:44 AM

Mouse Wheel Scroll Event

I have downloaded the Mouse Wheel Scroll routine from VB Thunder (Mouse Wheel Routine), which works fine. Also a control that should receive the mouse wheel scroll event can be specified; in my case a picture box.

HOWEVER ... I have added controls to my picture box - text boxes - which the user can edit. The text boxes are a child of the picture box. When this happens, the picture box loses focus, the text box will receive focus, and my picture box will not receive the event, while it still should.

Does anyone know how to solve this ?

Thank you.

Scroll Wheel On Mouse Not Working
My scroll wheel is not working on my mouse when I am looking at the code I want to scroll down to get through all the code and the only way to do this is the scroll bar which I can do but is there a way to make my mouse work. If anyone can help that would great.

Scroll MDI Container With Mouse Wheel???
Ok so here's the situation. I have a mdi container with a child form inside of it. The child forms is longer than the mdi container which creates a vertical scroll bar.

Is there any way to scroll the mdi container with the mouse wheel. So far I cannot get it working. I want to be able to scroll it with the mouse wheel, not just manually (point, click, drag). Any ideas??

Thanks guys! Any help would be appreciated!

Scroll Down A MSFlexGrid With Mouse Wheel
I'm using a flexgrid to show some data from my database.

So there's a problem i can't scroll down my flexgrid with the mouse i have to click on the scroll down bar. there's another way to do this using the mouse to scroll down to the last item contained in my flexgrid a not use the scroll down bar.

Using Mouse Scroll Wheel With VB Scrollbar
My program uses a scrollbar on one form. Is it possible to link this scrollbar to the center-wheel on the mouse?

Capturing The Mouse Scroll Wheel
Anybody know how to capture the mouse scroll wheel press, wheel up and wheel down?

I've tested for mouse up, mouse down, key up, key down . . .

It doesn't seen to trigger any of these events.

Disable Mouse Wheel - Trouble!
I've only found a single way on the entire internet to disable mouse scrolling... It was originally made for Access, but I adapted it for VB (see the attachment; it has the whole project).
It works fine, but when you unload the form/terminate the class, an error occurs, and since there is subclassing involved, the whole project crashes. Actually, when running it in IDE, no major thing happens... when compiled into an Activex DLL, the problem gets big.
Can anyone check the code to see if something is wrong? I've commented the section where the error occurs.

Mouse Scroll Wheel Won't Work In VB Editor
My mouse scroll wheel works fine in every other application, but when I try to scroll through the code in the MS VB editor: nothing. I can even scroll thru the VB project explorer in the MS VB editor no problem.

What's up with this? This happens on my home computer, too.

I also just got a new comp and never had the scroll issues on the old one. Noticed it with the new comp, though.

About The Editor Ambient... And Mouse Wheel Scroll
this question is quite unusual cause is not refered to code.
My mouse wheel scroll doesn't work in editor ambient.. there's any way of making it working?

it works at my home pc (without i've done anything particular!)... but here at work it doesn't work...

Mouse Wheel Event How To Set Picturebox Scroll
Dear Expert
now I have problem for mouse wheel move up and down in picturebox control

any one explain with code pls


Can't Scroll Code Window W/ Wheel Mouse
It sucks having to use the vertical scroll bar to move down the page. My mouse wheel works in every other microsoft app, is there a fix?

Disable The Mouse-wheel Double-click
We use some software @ my place of work that heavily utilises the mouse-wheel scroll up & down, and the single click & drag of the mouse-wheel, so these are needed.
However, the double-click of the mouse wheel (which happens accidentally all the time) causes us no end of problems.
Does anyone know a way to disable just the mouse-wheel double-click?
Thanks for any & all help,

A salesman is a machine for turning coke into obnoxious arrogance.

Common sense is what tells you the world is flat.

Access 2003 Disable Mouse Wheel
Hi everyone.

I have the following code, but I can't seem to get it to work:

Form Code

Private Sub Form_MouseWheel(ByVal Page As Boolean, ByVal Count As Long)
modCancel = True 'ERROR line
End Sub

Private Sub Form_BeforeUpdate(Cancel As Integer)
If modCancel = True Then
   Cancel = True
   modCancel = False
End If
End Sub


Option Compare Database
Option Explicit
Dim modCancel As Boolean

When open the form in form view, it errors out on the modCancel = True line stating that variable is not defined.

What am I doing wrong?

Thank you,


MSFlexGrid - Vertical Scrollbar - Mouse Scroll Wheel
Guys, I've been beating my head against the wall for a couple of days now. I can not get my scroll wheel (mouse) to operate the vertical scroll bar of my MSFlexGrid.

I'm sure it's something as stupid as 4 lines of code but all the same, I'm stuck!

Would one of you post the code I require please. I'd be ever so grateful!!


Problem Using Mouse Wheel As Universal Scroll In VBA Module
I am very confused by this.

I have a computer at work that I can roll the wheel and it scrolls just like it should (Win NT, Office 2k); however, I had a computer at work that wouldn't (Win NT, Office 97). Both used the same mouse/drivers (Logitech).

Now i am at home using (Win Xp SP1, Office XP SP2) my logitech mouse and I my universal scroll doesn't work in my VBA Module. It is quite frustrating since it works fine in the Excel worksheets.

Does anyone have info about this???

How To Register Scroll Wheel/middle/other Mouse Clicks
I assume it is an API, but I have been unable to find any under the API viewer and google as of yet. Better yet, could you make a class module that calls a specific function for each click, essentially making your own interface?

Middle Mouse Scroll Wheel In Code Window
I am using vb6. I would like to use my middle mouse scroll wheel to scroll through my code in the Code window. It scrolls the procedure box and the object box, just not the code window. I have to scroll with the arrows or the thumb. Is there a setting to get it to work? Thanks.

Mouse Scroll Wheel Wont Work In IDE { RESOLVED }
I have microsoft IntelliMouse and the scroll wheel doesn't work in Visual Studio 6 IDE. However it works in Visual Studio.NET IDE and Delphi IDE and as a matter of fact everywhere else.

Is there any special setting I need to take care of since it used to work before.


** Resolved ** Mouse Scroll Wheel Stops Working In VB Environment !??!
I'm running VB6 SP5 under Windows Xp Professional.

Any other application (Word, Excel etc.) my scroll wheel on my mouse works fine.

When I am coding in VB it refuses to scroll my code up and down ?!?!?!

Is this a common problem ?

Is it something XP related ?

Confused !

Disable Mouse Scroll (Access)
Is it possible to disable the mouse scroll because at this moment
when the scroll wheel is moved Access changes from record.

This is not good because in some cases it may only be possible
to access 1 record on a form.

Can we disable the scrollwheel with VBA-code??

Disable Mouse Scroll In Sub Form
Hi All,

I'm using MS Access 2000.

I have a form that incorporates two sub forms.

All of these forms are used for data entry. And it is for that reason I need to disable the mouse scroll in each form (so the user can not scroll into another record and accidently write over it).

I have some code that disables the mouse scroll in the main form. But when that same code is entered into the sub forms, I start to have problems:

1) The Drop Down boxes no longer work.
2) Niether the Horizontal or Vertical scroll bars (on the subforms) work (the scroll bar does not move)

Here is the code that I am using:
It includes 3 modules:
Module 1 (a Standard Module named basSubClassWindow):

Option Compare Database
Option Explicit

Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" _
(ByVal hwnd As Long, _
ByVal nIndex As Long, _
ByVal dwNewLong As Long) As Long

Public Declare Function CallWindowProc Lib "user32" Alias "CallWindowProcA" _
(ByVal lpPrevWndFunc As Long, _
ByVal hwnd As Long, _
ByVal msg As Long, _
ByVal wParam As Long, _
ByVal lParam As Long) As Long

Public Const GWL_WNDPROC = -4
Public Const WM_MouseWheel = &H20A
Public lpPrevWndProc As Long
Public CMouse As CMouseWheel

Public Function WindowProc(ByVal hwnd As Long, _
ByVal uMsg As Long, _
ByVal wParam As Long, _
ByVal lParam As Long) As Long

'Look at the message passed to the window. If it is
'a mouse wheel message, call the FireMouseWheel procedure
'in the CMouseWheel class, which in turn raises the MouseWheel
'event. If the Cancel argument in the form event procedure is
'set to False, then we process the message normally, otherwise
'we ignore it. If the message is something other than the mouse
'wheel, then process it normally
Select Case uMsg
Case WM_MouseWheel
If CMouse.MouseWheelCancel = False Then
WindowProc = CallWindowProc(lpPrevWndProc, hwnd, uMsg, wParam, lParam)
End If

Case Else
WindowProc = CallWindowProc(lpPrevWndProc, hwnd, uMsg, wParam, lParam)
End Select
End Function

Module 2 (a Class Module named CMouseWheel)

Option Compare Database
Option Explicit

Private frm As Access.Form
Private intCancel As Integer
Public Event MouseWheel(Cancel As Integer)

Public Property Set Form(frmIn As Access.Form)
'Define Property procedure for the class which
'allows us to set the Form object we are
'using with it. This property is set from the
'form class module.
Set frm = frmIn
End Property

Public Property Get MouseWheelCancel() As Integer
'Define Property procedure for the class which
'allows us to retrieve whether or not the Form
'event procedure canceled the MouseWheel event.
'This property is retrieved by the WindowProc
'function in the standard basSubClassWindow

MouseWheelCancel = intCancel
End Property

Public Sub SubClassHookForm()
'Called from the form's OnOpen or OnLoad
'event. This procedure is what "hooks" or
'subclasses the form window. If you hook the
'the form window, you must unhook it when completed
'or Access will crash.

lpPrevWndProc = SetWindowLong(frm.hwnd, GWL_WNDPROC, _
AddressOf WindowProc)
Set CMouse = Me
End Sub

Public Sub SubClassUnHookForm()
'Called from the form's OnClose event.
'This procedure must be called to unhook the
'form window if the SubClassHookForm procedure
'has previously been called. Otherwise, Access will

Call SetWindowLong(frm.hwnd, GWL_WNDPROC, lpPrevWndProc)
End Sub

Public Sub FireMouseWheel()

'Called from the WindowProc function in the
'basSubClassWindow module. Used to raise the
'MouseWheel event when the WindowProc function
'intercepts a mouse wheel message.
RaiseEvent MouseWheel(intCancel)
End Sub

And here is Module 3, a From Module:

Option Compare Database
Option Explicit
Public WithEvents clsMouseWheel As CMouseWheel
'Declare a module level variable as the custom class
'and give us access to the class's events

Public Sub Form_Load()
'Create a new instance of the class,
'and set the class's Form property to
'the current form
Set clsMouseWheel = New CMouseWheel
Set clsMouseWheel.Form = Me

'Subclass the current form by calling
'the SubClassHookForm method in the class
End Sub

Public Sub Form_Close()
'Unhook the form by calling the
'SubClassUnhook form method in the
'class, and then destroy the object

Set clsMouseWheel.Form = Nothing
Set clsMouseWheel = Nothing
End Sub
Public Sub clsMouseWheel_MouseWheel(Cancel As Integer)
'This is the event procedure where you can
'decide what to do when the user rolls the mouse.
'If setting Cancel = True, we disable the mouse wheel
'in this form.

MsgBox "You cannot use the mouse wheel to scroll through records."
Cancel = True
End Sub

If you have any ideas at all, I'd appreciate it if you'd share them with me....

Thanks a lot for your time and help,

Scroll Wheel
how can i use the mouse scroll wheel?When scrolling up or down for example. Thx if anyone can help me

Help Scroll Wheel
I have 2 MSFlexGrids on a form and would like to be able to use the mouse wheel to scroll both MSFlexGrids, instead of having to use the scrollbar arrows. I have used the code on this link but the code will only work for 1 MSFlexGrid.

' In Module
Private Declare Function CallWindowProc Lib "user32.dll" _
Alias "CallWindowProcA" ( _
ByVal lpPrevWndFunc As Long, _
ByVal hWnd As Long, _
ByVal Msg As Long, _
ByVal Wparam As Long, _
ByVal Lparam As Long) As Long

Private Declare Function SetWindowLong Lib "user32.dll" _
Alias "SetWindowLongA" ( _
ByVal hWnd As Long, _
ByVal nIndex As Long, _
ByVal dwNewLong As Long) As Long

Public Const MK_CONTROL = &H8
Public Const MK_LBUTTON = &H1
Public Const MK_RBUTTON = &H2
Public Const MK_MBUTTON = &H10
Public Const MK_SHIFT = &H4
Private Const GWL_WNDPROC = -4
Private Const WM_MOUSEWHEEL = &H20A

Dim LocalHwnd As Long
Dim LocalPrevWndProc As Long
Dim MyForm As Form

Private Function WindowProc(ByVal Lwnd As Long, ByVal Lmsg As Long, _
ByVal Wparam As Long, ByVal Lparam As Long) As Long

Dim MouseKeys As Long
Dim Rotation As Long
Dim Xpos As Long
Dim Ypos As Long

MouseKeys = Wparam And 65535
Rotation = Wparam / 65536
Xpos = Lparam And 65535
Ypos = Lparam / 65536
MyForm.MouseWheel MouseKeys, Rotation, Xpos, Ypos
End If
WindowProc = CallWindowProc(LocalPrevWndProc, Lwnd, Lmsg, Wparam, Lparam)
End Function

Public Sub WheelHook(PassedForm As Form)

On Error Resume Next

Set MyForm = PassedForm
LocalHwnd = PassedForm.hWnd
LocalPrevWndProc = SetWindowLong(LocalHwnd,GWL_WNDPROC,AddressOf WindowProc)
End Sub

Public Sub WheelUnHook()
Dim WorkFlag As Long

On Error Resume Next
WorkFlag = SetWindowLong(LocalHwnd, GWL_WNDPROC, LocalPrevWndProc)
Set MyForm = Nothing
End Sub

' In Form
Public Sub MouseWheel(ByVal MouseKeys As Long, ByVal Rotation As Long, _
ByVal Xpos As Long, ByVal Ypos As Long)
Dim NewValue As Long
Dim Lstep As Single

On Error Resume Next

With MsFlexgrid1
Lstep = .Height / .RowHeight(0)
Lstep = Int(Lstep)
If Lstep < 10 Then
Lstep = 10
End If
If Rotation > 0 Then
NewValue = .TopRow - Lstep
If NewValue < 1 Then
NewValue = 1
End If
NewValue = .TopRow + Lstep
If NewValue > .Rows - 1 Then
NewValue = .Rows - 1
End If
End If
.TopRow = NewValue
End With
End Sub
How can it be done to scroll 2 MSFlexGrids?

Thank you.

Scroll Wheel In VB6
Does anyone know if it's possible to scoll in the code window using the mouse wheel? I can scroll in any other program but VB6.


Scroll Wheel
Does anyone know how to make my program interface with the scroll wheel on my mouse?

Scroll Wheel
Does anyone know of an API call that will disable the Scroll Wheel on an intellimouse



Any Solution To Scroll Wheel In VB6?
It's really annoying that VB 6 doesn't support the scroll wheel on mouses, is there a patch or something to add this support to VB6?


Scroll Wheel Input
is it possible in VB to receive input from a scroll wheel on a mouse?
it's because i'm making a picture viewer and it would be nice if i could scroll through pics with the sroll wheel....


Scroll Wheel Server
Hi all,

I used to have a program called the Scroll Wheel server. I'm not sure who made it but the exe name is WheelServer.exe - there's not much on Google about it. I also remember that the folder name that it was in was 8118.

This program is an exe (Though I believe it also came with the code) that allows you to use the scroll wheel in the VB6 IDE. However, after a format I have found that the program is missing, and I can't find it on a forum search or Google.

Any ideas?


Scroll Wheel Problem
I have a Datagrid on one form that uses a subClass that I downloaded from this forum and it works perfectly.

How do I reference that subclass for a different form and datagrid? Even out own VB chief is stuck.

Code is below
Original form Load and Unload

Private Sub Form_Load()
SubClassWnd Me.hwnd
End Sub

Private Sub Form_Unload(Cancel As Integer)
UnSubclassWnd Me.hwnd
End Sub


Declare Function SetWindowLong& Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long)
Declare Function CallWindowProc Lib "user32" Alias "CallWindowProcA" (ByVal lpPrevWndFunc As Long, ByVal hwnd As Long, ByVal msg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Const GWL_WNDPROC = (-4)
'These are the messages
Global WndProcOld As Long
Global FormName As String

Public Function WindProc(ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
'checks the messages
If wParam < 0 Then
frmClaimsList.DataGridClaimsList.Scroll 0, 1
frmClaimsList.DataGridClaimsList.Scroll 0, -1
End If
End If
WindProc = CallWindowProc(WndProcOld&, hwnd&, wMsg&, wParam&, lParam&)
End Function

Sub SubClassWnd(hwnd As Long)
WndProcOld& = SetWindowLong(hwnd, GWL_WNDPROC, AddressOf WindProc)
End Sub

Sub UnSubclassWnd(hwnd As Long)
SetWindowLong hwnd, GWL_WNDPROC, WndProcOld&
WndProcOld& = 0
End Sub

I have a form called frmMajor which had a datagrid called dgrdMajor and I want to be able to use the scroll wheel on this form and datgrid as well.

Any ideas?
Thanks in advance

Scroll Wheel Thingy
Does anybody know why I can't use my scroll wheel in vb6, the editor i mean? I haven't been able to forever, but it is just starting to piss me off now!!!!1 Thanks for any help.

Scroll Wheel & Msflexgrid
hopefully the last ever msflexgrid question from me....

Anyone know how to implement a mouse scroll wheel with the flex grid ???



Scroll Wheel On Code
Hi all,

i used to be able to scroll up and down my code with the mouse wheel, but i must have turned the feature off. Does anyone know how to bring it back? Thanx


Scroll Wheel In Code (Resolved)
Sorry if this is just stupid, but I can't seem to use the mouse's scroll wheel when view code is full screen. I just installed VB on my new laptop and I can't scroll. Is this a common problem with sp6 of VB? (The wheel scrolls fine for other apps)...

Copyright 2005-08, All rights reserved