Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Multi Page Scroll Bar
First, forgive the Repost. I didn't get any replies over the weekend.
I am trying to get the horizontal scroll bar on a MultiPage page to work. I have a main MultiPage (MultiPage1). On each page of the main MP there is another (sub-) MultiPage (i.e. MultiPage2 is on Page1 (index 0) of MultiPage1). The following code works to insert Horizontal Scroll Bars on the correct page (of the sub- MultiPage) and with the correct horizontal scroll range, but nothing I do will affect the ScrollLeft Property. (I've included 3 examples of what I have tried - none of them do anything.) I do not get any kind of errors, just a scroll bar that is positioned wherever excel wants it (usually about 1/8 of the way from the left edge). As a note, I have tried a Me.Repaint at the end of the Sub with no effect. I have many of these pages that are created programmatically and it is not possible to set them manually. Thanks in advance for any help!! Private Sub UserForm_Initialize() hWnd = FindWindow(vbNullString, Me.Caption) SetWindowLong hWnd, -16, &H84CE0080 MultiPage2.Pages(0).ScrollBars = fmScrollBarsHorizontal MultiPage2.Pages(0).KeepScrollBarsVisible = fmScrollBarsHorizontal MultiPage2.Pages(0).ScrollWidth = 805 MultiPage2.Pages(0).ScrollLeft = MultiPage2.Pages(0).ScrollWidth _ - MultiPage2.Width MultiPage2.Pages(0).ScrollLeft = 0 MultiPage2.Pages(0).ScrollLeft = MultiPage2.Width / 2 End Sub |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Multi Page Scroll Bar
I believe Excel might automatically adjust the scroll position if the active
control is outside of the visible area... you can try to intercept it in the scroll event of the multipage. something like this: Option Explicit Public bInitializing As Boolean Private Sub MultiPage2_Scroll(ByVal Index As Long, _ 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 bInitializing Then ActualDx = 0 bInitializing = False End If End Sub Private Sub UserForm_Initialize() bInitializing = True MultiPage2.Pages(0).ScrollBars = fmScrollBarsHorizontal MultiPage2.Pages(0).ScrollWidth = 800 End Sub -- Hope that helps. Vergel Adriano "Brandt" wrote: First, forgive the Repost. I didn't get any replies over the weekend. I am trying to get the horizontal scroll bar on a MultiPage page to work. I have a main MultiPage (MultiPage1). On each page of the main MP there is another (sub-) MultiPage (i.e. MultiPage2 is on Page1 (index 0) of MultiPage1). The following code works to insert Horizontal Scroll Bars on the correct page (of the sub- MultiPage) and with the correct horizontal scroll range, but nothing I do will affect the ScrollLeft Property. (I've included 3 examples of what I have tried - none of them do anything.) I do not get any kind of errors, just a scroll bar that is positioned wherever excel wants it (usually about 1/8 of the way from the left edge). As a note, I have tried a Me.Repaint at the end of the Sub with no effect. I have many of these pages that are created programmatically and it is not possible to set them manually. Thanks in advance for any help!! Private Sub UserForm_Initialize() hWnd = FindWindow(vbNullString, Me.Caption) SetWindowLong hWnd, -16, &H84CE0080 MultiPage2.Pages(0).ScrollBars = fmScrollBarsHorizontal MultiPage2.Pages(0).KeepScrollBarsVisible = fmScrollBarsHorizontal MultiPage2.Pages(0).ScrollWidth = 805 MultiPage2.Pages(0).ScrollLeft = MultiPage2.Pages(0).ScrollWidth _ - MultiPage2.Width MultiPage2.Pages(0).ScrollLeft = 0 MultiPage2.Pages(0).ScrollLeft = MultiPage2.Width / 2 End Sub |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Multi Page Scroll Bar
Vergel,
That seemed to work. I'll keep testing it, but thank you very much. As a note to your comment, would there be a way to programatically make a controll or picture active (without setting it's value to true) that I knew was on the Left side of the page so that the scroll bar would be set there? Brandt "Vergel Adriano" wrote: I believe Excel might automatically adjust the scroll position if the active control is outside of the visible area... you can try to intercept it in the scroll event of the multipage. something like this: Option Explicit Public bInitializing As Boolean Private Sub MultiPage2_Scroll(ByVal Index As Long, _ 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 bInitializing Then ActualDx = 0 bInitializing = False End If End Sub Private Sub UserForm_Initialize() bInitializing = True MultiPage2.Pages(0).ScrollBars = fmScrollBarsHorizontal MultiPage2.Pages(0).ScrollWidth = 800 End Sub -- Hope that helps. Vergel Adriano "Brandt" wrote: First, forgive the Repost. I didn't get any replies over the weekend. I am trying to get the horizontal scroll bar on a MultiPage page to work. I have a main MultiPage (MultiPage1). On each page of the main MP there is another (sub-) MultiPage (i.e. MultiPage2 is on Page1 (index 0) of MultiPage1). The following code works to insert Horizontal Scroll Bars on the correct page (of the sub- MultiPage) and with the correct horizontal scroll range, but nothing I do will affect the ScrollLeft Property. (I've included 3 examples of what I have tried - none of them do anything.) I do not get any kind of errors, just a scroll bar that is positioned wherever excel wants it (usually about 1/8 of the way from the left edge). As a note, I have tried a Me.Repaint at the end of the Sub with no effect. I have many of these pages that are created programmatically and it is not possible to set them manually. Thanks in advance for any help!! Private Sub UserForm_Initialize() hWnd = FindWindow(vbNullString, Me.Caption) SetWindowLong hWnd, -16, &H84CE0080 MultiPage2.Pages(0).ScrollBars = fmScrollBarsHorizontal MultiPage2.Pages(0).KeepScrollBarsVisible = fmScrollBarsHorizontal MultiPage2.Pages(0).ScrollWidth = 805 MultiPage2.Pages(0).ScrollLeft = MultiPage2.Pages(0).ScrollWidth _ - MultiPage2.Width MultiPage2.Pages(0).ScrollLeft = 0 MultiPage2.Pages(0).ScrollLeft = MultiPage2.Width / 2 End Sub |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Multi Page Scroll Bar
Brandt,
When you enter a tab page, the first control in the tab sequence will have the focus. So, what you can do is pick the control on the top left corner and set the tabindex property to 0. Or, to programmatically set the focus, you can use the SetFocus method... -- Hope that helps. Vergel Adriano "Brandt" wrote: Vergel, That seemed to work. I'll keep testing it, but thank you very much. As a note to your comment, would there be a way to programatically make a controll or picture active (without setting it's value to true) that I knew was on the Left side of the page so that the scroll bar would be set there? Brandt "Vergel Adriano" wrote: I believe Excel might automatically adjust the scroll position if the active control is outside of the visible area... you can try to intercept it in the scroll event of the multipage. something like this: Option Explicit Public bInitializing As Boolean Private Sub MultiPage2_Scroll(ByVal Index As Long, _ 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 bInitializing Then ActualDx = 0 bInitializing = False End If End Sub Private Sub UserForm_Initialize() bInitializing = True MultiPage2.Pages(0).ScrollBars = fmScrollBarsHorizontal MultiPage2.Pages(0).ScrollWidth = 800 End Sub -- Hope that helps. Vergel Adriano "Brandt" wrote: First, forgive the Repost. I didn't get any replies over the weekend. I am trying to get the horizontal scroll bar on a MultiPage page to work. I have a main MultiPage (MultiPage1). On each page of the main MP there is another (sub-) MultiPage (i.e. MultiPage2 is on Page1 (index 0) of MultiPage1). The following code works to insert Horizontal Scroll Bars on the correct page (of the sub- MultiPage) and with the correct horizontal scroll range, but nothing I do will affect the ScrollLeft Property. (I've included 3 examples of what I have tried - none of them do anything.) I do not get any kind of errors, just a scroll bar that is positioned wherever excel wants it (usually about 1/8 of the way from the left edge). As a note, I have tried a Me.Repaint at the end of the Sub with no effect. I have many of these pages that are created programmatically and it is not possible to set them manually. Thanks in advance for any help!! Private Sub UserForm_Initialize() hWnd = FindWindow(vbNullString, Me.Caption) SetWindowLong hWnd, -16, &H84CE0080 MultiPage2.Pages(0).ScrollBars = fmScrollBarsHorizontal MultiPage2.Pages(0).KeepScrollBarsVisible = fmScrollBarsHorizontal MultiPage2.Pages(0).ScrollWidth = 805 MultiPage2.Pages(0).ScrollLeft = MultiPage2.Pages(0).ScrollWidth _ - MultiPage2.Width MultiPage2.Pages(0).ScrollLeft = 0 MultiPage2.Pages(0).ScrollLeft = MultiPage2.Width / 2 End Sub |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How do I e-mail 1 page of a multi page workbook | Excel Discussion (Misc queries) | |||
Get header only on first page of multi page excel file | Excel Discussion (Misc queries) | |||
Multi-page and Scroll bars | Excel Programming | |||
multi page copy | Excel Discussion (Misc queries) | |||
Hide a page in a multi page userform | Excel Programming |