Free Microsoft Excel 2013 Quick Reference

Scroll ComboBox With Mouse Wheel

I have 1 issue with the Control Toolbox's Combo-box

when the combo list is shown & you use the mouse scroll wheel, the whole list moves with the scroll down function, but the combo box stays fixed to the page

I want to disable the mouse wheel if possible or when the mouse wheel moves only the list srcols down not the page.

example

Combo Box1.xls

Can anyone help me.

Thanks

Panic


Why doesn't the scroll wheel on my mouse make the page scroll when I'm
selecting cells? I hate the way the cell selection auto scrolls the page, I
always end up going farther than I want to.

All I want is the ability to control the scrolling of the page with the
standard scrolling control, the mouse wheel!

----------------
This post is a suggestion for Microsoft, and Microsoft responds to the
suggestions with the most votes. To vote for this suggestion, click the "I
Agree" button in the message pane. If you do not see the button, follow this
link to open the suggestion in the Microsoft Web-based Newsreader and then
click "I Agree" in the message pane.

http://www.microsoft.com/office/comm...lic.excel.misc

Hello to all!

Is there a way to scroll down the list of entries in a combobox using the mouse wheel instead of clicking on the box to scroll up and down?

Any input would be appreciated.

Thanks,
Username99

Hi again,

I am having problems with an Excel workbook I am working on. I have a sheet that has a number of controls added to the top of it. Two of these controls are listboxes.

My problem is, if I am in the listbox navigating through it, and I accidently move the Mouse Wheel, Excel crashes and I get the usual, "Send Error Report" form.

I have seen that there are other people having this problem and that there are a number of solutions out there but my problem is a bit different.

I have a few forms with listboxes on them, and while mouse wheel scrolling doesn't work, it certainly doesn't crash Excel.

It only seems to happen when I have a control permanently added to the sheet.

Is there any event handler for mouse wheel scrolls or anyway to disable them through VB?

Any help would be much appreciated as I have lost loads of unsaved work due to impulsive mouse wheel scrolling.

Thanks in advance,
Peter

It would be nice if one could navigate Excel with the mouse wheel in the same
way one can navigate a Visio diagram. Yes, one can scroll up and down with
the mouse wheel (at least in Office 2003) but one cannot scroll left to right
(i.e., by holding the key while rolling the mouse wheel as one can in
Viso). Excel worksheets can of course be quite large, so being able to
quickly move around like that would be very useful.

----------------
This post is a suggestion for Microsoft, and Microsoft responds to the
suggestions with the most votes. To vote for this suggestion, click the "I
Agree" button in the message pane. If you do not see the button, follow this
link to open the suggestion in the Microsoft Web-based Newsreader and then
click "I Agree" in the message pane.

http://www.microsoft.com/office/comm...lic.excel.misc

It would be nice if one could navigate Excel with the mouse wheel in the same
way one can navigate a Visio diagram. Yes, one can scroll up and down with
the mouse wheel (at least in Office 2003) but one cannot scroll left to right
(i.e., by holding the <Shift> key while rolling the mouse wheel as one can in
Viso). Excel worksheets can of course be quite large, so being able to
quickly move around like that would be very useful.

----------------
This post is a suggestion for Microsoft, and Microsoft responds to the
suggestions with the most votes. To vote for this suggestion, click the "I
Agree" button in the message pane. If you do not see the button, follow this
link to open the suggestion in the Microsoft Web-based Newsreader and then
click "I Agree" in the message pane.

http://www.microsoft.com/office/comm...lic.excel.misc

In general: With mouse wheel, we can scroll Up and Down in any application
e.g. IE, Ms Word, Ms Excel.

For me: Its working as expected in IE, Ms Word but not with Ms Excel. If I
use, mouse wheel, it Zoom IN or OUT. This functionality is common in other
application if I can use Ctrl+ Mouse Wheel in combo.

In this case even if dont use Ctrl, it behaves as if Ctrl is ON, but at the
same time, Mouse Wheel is working fine with other applicaitons.

Its pretty annoying.. I will appreciate any help.

I have installed Office Student & Teacher Edition 2003 on two machines - both
running XP Professional. On both computers I have optical wheel mouses (one
MS, one Logitech) with the wheel button set for double-click. However, on
either machine the double-click does not work when trying to open workbooks
in Excel 2003 (or documents in Word 2003 for that matter). The filename is
just highlighted, but if I press the wheel button a second time then the file
will open, even if there is a large time interval between the two clicks. On
one computer I upgraded from Office 2000 while the other was a fresh instal
on a fresh XP installation. Is there a fix for this problem?

Thanks
--
Joe

I have installed Office Student & Teacher Edition 2003 on two machines - both
running XP Professional. On both computers I have optical wheel mouses (one
MS, one Logitech) with the wheel button set for double-click. However, on
either machine the double-click does not work when trying to open workbooks
in Excel 2003 (or documents in Word 2003 for that matter). The filename is
just highlighted, but if I press the wheel button a second time then the file
will open, even if there is a large time interval between the two clicks. On
one computer I upgraded from Office 2000 while the other was a fresh instal
on a fresh XP installation. Is there a fix for this problem?

Thanks
--
Joe

Problem with file requester

When I start word and choose open, it opens file requester. I can't scroll down left side scrollbar, ie. favorites, desktop, download.... if I try scroll it down with mouse, it locks window and I can't choose cancel/open until I click with mouse outside of file requester window. How ever I can scroll down with mouse wheel, arrow keys etc. 
And please don't suggest basic solutions, updated, repaired, removed data key from registry etc.

Found some nice code on:

http://www.enhanceddatasystems.com/E...istScrolls.htm

to make a scrollable listbox.
The scrolling works perfect, but there are serious side-effects.
After doing some scrolling you can't move or even close the form anymore
and the only way out is Ctrl + Alt + Del.

Does anybody have a solution for this or does anybody has some better code
for this?
Maybe the answer to this is to use a VB6 listbox in Excel as I understand
that you can
do this. It just looks a bit more complex.

Thanks for any advice.

RBS

Hello All
I have seen some code around that allows scrolling in listboxes using the mousewheel. I have also seen some code here on the forums about scrolling through a combobox embedded in a workbook. I have tried adapting both of these to suit a combobox on a userform but I cannot get either to work.

Here is the code that I used for the embedded combobox; I added it to the base code for the userform
Code:
Private Sub ComboBox1_GotFocus()

    'Store the first TopIndex Value
    intTopIndex = ComboBox1.TopIndex
    Hook_Mouse

End Sub

Private Sub ComboBox1_LostFocus()

    UnHook_Mouse

End Sub
I then added the following code to a standard module as stated in the forum post;
Code:
Option Explicit

Declare Function FindWindow Lib "user32" Alias "FindWindowA" _
(ByVal lpClassName As String, ByVal lpWindowName As String) As Long

Declare Function GetForegroundWindow Lib "user32" () As Long

Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" _
(ByVal Destination As Long, ByVal Source As Long, ByVal Length As Long)

Declare Function SetWindowsHookEx Lib _
"user32" Alias "SetWindowsHookExA" (ByVal idHook As Long, ByVal lpfn As Long, _
ByVal hmod As Long, ByVal dwThreadId As Long) As Long

Declare Function CallNextHookEx Lib "user32" (ByVal hHook As Long, _
ByVal nCode As Long, ByVal wParam As Long, lParam As Any) As Long

Declare Function UnhookWindowsHookEx Lib "user32" (ByVal hHook As Long) As Long

Type POINTAPI
  X As Long
  Y As Long
End Type

Type MSLLHOOKSTRUCT 'Will Hold the lParam struct Data
    pt As POINTAPI
    mouseData As Long ' Holds ForwardBacward flag
    flags As Long
    time As Long
    dwExtraInfo As Long
End Type

Const HC_ACTION = 0
Const WH_MOUSE_LL = 14
Const WM_MOUSEWHEEL = &H20A

Dim hhkLowLevelMouse, lngInitialColor As Long
Dim udtlParamStuct As MSLLHOOKSTRUCT
Public intTopIndex As Integer

'==========================================================================
'Copy the Data from lParam of the Hook Procedure argument to our Struct
Function GetHookStruct(ByVal lParam As Long) As MSLLHOOKSTRUCT

   CopyMemory VarPtr(udtlParamStuct), lParam, LenB(udtlParamStuct)
   
   GetHookStruct = udtlParamStuct
   
End Function

'===========================================================================
Function LowLevelMouseProc _
(ByVal nCode As Long, ByVal wParam As Long, ByVal lParam As Long) As Long

    'Avoid XL crashing if RunTime error occurs due to Mouse fast movement
    On Error Resume Next

'     Unhook & get out in case the application is deactivated
    If GetForegroundWindow  FindWindow("XLMAIN", Application.Caption) Then
            ComboBox1.TopLeftCell.Select
            UnHook_Mouse
            Exit Function
    End If

    If (nCode = HC_ACTION) Then
   
        If wParam = WM_MOUSEWHEEL Then
       
                ' Don't process Default WM_MOUSEWHEEL Window message
                LowLevelMouseProc = True
           
                ' Change Sheet&DropDown names as required
                With ComboBox1

           
              ' if rolling forward increase Top index by 1 to cause an Up Scroll
                If GetHookStruct(lParam).mouseData > 0 Then
               
                    .TopIndex = intTopIndex - 1
               
                    ' Store new TopIndex value
                    intTopIndex = .TopIndex
               
                Else ' if rolling backward decrease Top index by 1 to cause _
                'a Down Scroll
               
                    .TopIndex = intTopIndex + 1
                   
                    ' Store new TopIndex value
                    intTopIndex = .TopIndex
               
                End If
               
           End With

        End If
       
        Exit Function
   
    End If

    LowLevelMouseProc = CallNextHookEx(0, nCode, wParam, ByVal lParam)
End Function

'=======================================================================
Sub Hook_Mouse()

hhkLowLevelMouse = SetWindowsHookEx _
(WH_MOUSE_LL, AddressOf LowLevelMouseProc, Application.Hinstance, 0)

End Sub

'========================================================================
Sub UnHook_Mouse()

    If hhkLowLevelMouse  0 Then UnhookWindowsHookEx hhkLowLevelMouse

End Sub
In the first section of the code there is a msgbox that never gets shown so I don't think code is recognizing the mouse wheel at all.

The second set of code that I used was set up to work with a listbox and it works perfectly with a listbox control. The problem is I cannot adapt it to suit a combobox and if I use a breakpoint to see what is happening Excel freezes.
The following code is added to the userforms code;
Code:
Private Sub UserForm_Initialize()
  HookWheel Me, Me.Width, Me.Height, 3
End Sub
Private Sub UserForm_Terminate()
  UnHookWheel
End Sub
Then in a standard module I added the following code;
Code:
Option Explicit
Option Private Module

'************************************************************
'APIs
'************************************************************
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
Private Declare Function FindWindowA Lib "user32" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function GetSystemMetrics Lib "user32" (ByVal nIndex As Long) As Long
Private Declare Function GetWindowRect Lib "user32" (ByVal hWnd As Long, lpRect As typeRect) As Long
'used to store screen position for GetWindowRect call
Private Type typeRect
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
'screen factor constants
Private dXFactor As Double 'hold screen Conversion coordinates
Private dYFactor As Double
Private lCaptionHeight As Long
'************************************************************
'Constants
'************************************************************
Private Const GWL_WNDPROC = -4
Private Const WM_MOUSEWHEEL = &H20A
Private Const SM_MOUSEWHEELPRESENT = 75
Private lLines As Long
'************************************************************
'Variables
'************************************************************
Private hForm As Long
Public lPrevWndProc As Long
Private lX As Long
Private lY As Long
Private bUp As Boolean
Private frmContainer As msForms.UserForm
'*************************************************************
'WindowProc
'*************************************************************
Private Function WindowProc(ByVal lWnd As Long, ByVal lMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
  'converted from code by Kevin Wilson on thevbzone
  'Test if the message is WM_MOUSEWHEEL
  If lMsg = WM_MOUSEWHEEL Then
    lX = lParam And 65535
    lY = lParam  65535
    bUp = (wParam > 0)
    WheelHandler bUp
  End If
  'Sends message to previous procedure if not MOUSEWHEEL
  'This is VERY IMPORTANT!!!
  If lMsg  WM_MOUSEWHEEL Then
    WindowProc = CallWindowProc(lPrevWndProc, lWnd, lMsg, wParam, lParam)
  End If
End Function

Public Sub HookWheel(ByVal frmName As msForms.UserForm, dWidth As Double, dHeight As Double, ByVal lLinesToScroll As Long)
  If WheelPresent Then
    Set frmContainer = frmName
    hForm = GetFormHandle(frmName)
    GetScreenFactors hForm, dWidth, dHeight
    lLines = lLinesToScroll
    'create the call back procedure
    'addressof doesn't work in earlier versions but not sure which ones
    lPrevWndProc = SetWindowLong(hForm, GWL_WNDPROC, AddressOf WindowProc)
  End If
End Sub

Public Sub UnHookWheel()
  'very important that this is called when the form is unloaded to remove the call back
  Call SetWindowLong(hForm, GWL_WNDPROC, lPrevWndProc)
End Sub

Private Function GetFormHandle(ByVal frmName As msForms.UserForm, Optional bByClass As Boolean = True) As Long
  'returns a handle to the userform
  Dim strClassName As String
  Dim strCaption As String
  strClassName = IIf(Val(Application.Version) > 8, "ThunderDFrame", "ThunderXFrame") & vbNullChar
  strCaption = vbNullString
  GetFormHandle = FindWindowA(strClassName, strCaption)
End Function

Public Sub GetScreenFactors(lHwnd As Long, dWidth As Double, dHeight As Double)
  'returns screen factors for conversion to Excel units rather than win coords
  Dim uRect As typeRect
  GetWindowRect lHwnd, uRect
  dXFactor = dWidth / (uRect.Right - uRect.Left)
  dYFactor = dHeight / (uRect.Bottom - uRect.Top)
  lCaptionHeight = dHeight - frmContainer.InsideHeight
End Sub

Private Function WheelPresent() As Boolean
  'function by Kevin Wilson from www.thevbzone.com
  'Check for wheel mouse on Win98, WinNT 4.0, & Win2000
  If GetSystemMetrics(SM_MOUSEWHEELPRESENT) Then
    WheelPresent = True
    ' Check for wheel mouse on Win32's, Win95, & WinNT 3.5x
  ElseIf FindWindowA("MouseZ", "Magellan MSWHEEL")  0 Then
    WheelPresent = True
  End If
End Function

Public Sub WheelHandler(bUp As Boolean)
  Dim ctlFocus As msForms.Control
  Dim ctlName As msForms.Control
  Dim lTopIndex As Long
  Dim bMultiPage As Boolean
  Dim lPage As Long
  Dim lMove As Long
  If Not IsOverForm Then Exit Sub
  Set ctlFocus = frmContainer.ActiveControl
  'if we are in a multipage then need to set the control
  'to whatever the subcontrol is on the active page
  If TypeOf ctlFocus Is msForms.MultiPage Then
    'set the multipage flag
    bMultiPage = True
    'store the page number for the MP
    lPage = ctlFocus.Value
    'set the focus control to the control on the current page
    Set ctlFocus = ctlFocus.SelectedItem.ActiveControl
  End If
  'convert screen coords
  lX = lX * dXFactor
  lY = lY * dYFactor
  lY = lY - lCaptionHeight
  'for anything but a commandbutton and textbox lx is relative to the left
  'and top of the control, so adjust
  If Not (TypeOf ctlFocus Is msForms.CommandButton Or TypeOf ctlFocus Is msForms.TextBox) Then
    'lX = lX + ctlFocus.Left
    'lY = lY + ctlFocus.Top
  End If
  'loop controls, looking for list boxes
  For Each ctlName In frmContainer.Controls
    With ctlName
      If TypeOf ctlName Is msForms.ListBox Then
        'if we are in a multipage
        If bMultiPage = True Then
          'if we are not on the correct page then skip this control
          If lPage  .Parent.Index Then GoTo SkipControl
        End If
        'check right of left bound
        If lX > .Left Then
          'check within width
          If lX < .Left + .Width Then
            'check below top bound
            If lY > .Top Then
              'check within height
              If lY < .Top + .Height Then
                'WE FOUND THE RIGHT CONTROL SO HANDLE THE SCROLL
                'if the list is empty there is nothing to scroll
                If .ListCount = 0 Then Exit Sub
                'check scroll direction
                lMove = IIf(bUp, -lLines, lLines)
                'get the new top index
                lTopIndex = .TopIndex + lMove
                'check it is within valid limits
                If lTopIndex < 0 Then
                  lTopIndex = 0
                ElseIf lTopIndex > .ListCount - (.Height / 10) + 2 Then
                  lTopIndex = .TopIndex
                End If
                'set the new top index
                .TopIndex = lTopIndex
                'scroll has been handled so stop looping
                Exit Sub
              End If
            End If
          End If
        End If
      End If
      If TypeOf ctlName Is msForms.ComboBox Then
        'if we are in a multipage
        If bMultiPage = True Then
          'if we are not on the correct page then skip this control
          If lPage  .Parent.Index Then GoTo SkipControl
        End If
        'check right of left bound
        If lX > .Left Then
          'check within width
          If lX < .Left + .Width Then
            'check below top bound
            If lY > .Top Then
              'check within height
              If lY < .Top + .Height Then
                'WE FOUND THE RIGHT CONTROL SO HANDLE THE SCROLL
                'if the list is empty there is nothing to scroll
                If .ListCount = 0 Then Exit Sub
                'check scroll direction
                lMove = IIf(bUp, -lLines, lLines)
                'get the new top index
                lTopIndex = .TopIndex + lMove
                'check it is within valid limits
                If lTopIndex < 0 Then
                  lTopIndex = 0
                ElseIf lTopIndex > .ListCount - (.Height / 10) + 2 Then
                  lTopIndex = .TopIndex
                End If
                'set the new top index
                .TopIndex = lTopIndex
                'scroll has been handled so stop looping
                Exit Sub
              End If
            End If
          End If
        End If
      End If
    End With
SkipControl:
  Next ctlName
End Sub

Public Function IsOverForm() As Boolean
  'we can't get the form's coordinates directly when referenced as a form
  'rather than ME within the form's code
  'so call GetWindowRect again in case the form has been moved
  Dim uRect As typeRect
  GetWindowRect hForm, uRect
  With uRect
    If lX >= .Left Then
      If lX = .Top Then
          If lY

I add frame with vertical scrollbar on the Userform. I can scroll that vertical scroll by moving mouse up and down while holding the left button of mouse. However I cannot scroll using mouse wheel (middle mouse button wheel). Need help

How can i make my mouse wheel scroll an excel sheet sideways instead of up and down?

my sheets are only 5 rows big, but some 20 columns and its a pain to move around the sheet efficiently!

Hello Excel Forum,

With my mouse's wheel it's possible to scroll vertically in excel, however, is there a button I can hit and then use the mouse wheel to scroll sideways as well?

Thanks for any suggestions,

Jesper

Hi,

Is there away to make the minimum and maximum scales on a graph change by scrolling up or down with your mouse wheel, so in effect you could artificially zoom in or out on your chart?

This is probably a ridiculous question - but does anyone know if it's a setting somewhere that your mouse wheel can scroll up and down in VBA editor?
My mouse wheel works fine with every other application, and I have tried various versions of the driver, with varying results with other applications. However, even with the newest drivers (standard Dell mouse) - the wheel works in every other application I've tried, just not in the VBA editor.
It drives me nuts every time I'm coding.
Anyone have any suggestions?

Just upgraded from Excel 2003 to 2007. In 2003 I was able to scroll
horizontal with my Microsoft 6000 laser mouse. Not in 2007. Who can help me?

Using the mouse wheel will scroll horizontally or vertically depending on
where the cursor is on the screen. I want it to only scroll vertically no
matter where the cursor is on the screen just like it was in Excel 2000.

Hi,

Do U know how can I get my mouse wheel to scroll up and down inside the VBA editor window ?

I installed the updated MouseWare driver ver 9.79 from "Logitech" site.

The mouse functions fine - but not as described above.

Thanks,
Michael Avidan

Is there anyway to scroll by clicking or rolling the mouse instead of having to drag the scroll bars down on a userform.

thanks for any input

Josh

How can I use my mouse wheel to scroll down a drop down list?

Strange one this one. I have a document with multiple tabs, on one of these tabs the mouse wheel does not scroll the page up and down.

Ohh yeah it's Winxp Prof SP2, office 2003 SP2.

Any ideas?

Hi,

I think it would be great if mouses adopted a second scroll button, for
horizontal scrolling, just like the vertical one .... Indeed, when you work
with wide Excel spreadsheets, you can easily scroll down but to scroll from
left to right or vice-versa, you have to use the scroll bar or arrows and
it's annoying...

So, am I a millionnaire yet???

Right click "sheet 1" then click on "view code" I can see all the
beeauutifullll code that I have written. However when I want to scroll using
the mouse wheel, the code doesn't scroll up or down. I have to click and
hold the scroll bar to move the code up or down. Is this a setting or a flaw?
Mouse scroll works in the spread sheet.

Thoughts appreciated

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...tions/200708/1