How to stop scrollbar from jumping to active frame

bradyboyy88

Well-known Member
Joined
Feb 25, 2015
Messages
562
I have a userform with a frame (called Parent_Frame) that takes up the entire userform and the vertical scrollbar is activated. Inside this frame about halfway is 3 menu items each which active another frame underneath of them. Well all works well however right when I click on one of these inner frame's body the Parent_Frame scroll bar shoots down to the inner frames top. Is there anyway possible to stop this from automatically happening?
 

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce
If anyone else is having this issue. Here is the solution:

Code:
Private Sub Parent_Frame_Scroll(ByVal ActionX As MSForms.fmScrollAction, ByVal ActionY As MSForms.fmScrollAction, ByVal RequestDx As Single, ByVal RequestDy As Single, ByVal ActualDx As MSForms.ReturnSingle, ByVal ActualDy As MSForms.ReturnSingle)


    If ActionY = fmScrollActionFocusRequest Then
        ActualDy.Value = 0
    End If
    
End Sub
 
Upvote 0
If anyone else is having this issue. Here is the solution:

Code:
Private Sub Parent_Frame_Scroll(ByVal ActionX As MSForms.fmScrollAction, ByVal ActionY As MSForms.fmScrollAction, ByVal RequestDx As Single, ByVal RequestDy As Single, ByVal ActualDx As MSForms.ReturnSingle, ByVal ActualDy As MSForms.ReturnSingle)


    If ActionY = fmScrollActionFocusRequest Then
        ActualDy.Value = 0
    End If
    
End Sub

Hi bradyboy88 ..this code works well thanks but not on listboxes, those still refocus...any idea why? Thansk
 
Upvote 0
I am not sure but I am hoping someone might be able to help with this issue. It does this still to if you have a frame within a frame within a frame. The first frame is captured by the focus request but the next integrated frame does not trigger this request.
 
Upvote 0
I am not sure but I am hoping someone might be able to help with this issue. It does this still to if you have a frame within a frame within a frame. The first frame is captured by the focus request but the next integrated frame does not trigger this request.

To make it more univseral you need to use this:

Code:
    If ActionY = fmScrollActionFocusRequest Or ActionY = fmScrollActionControlRequest Then
        ActualDy.value = 0
    End If
 
Upvote 0

Forum statistics

Threads
1,223,888
Messages
6,175,219
Members
452,620
Latest member
dsubash

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top