ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   VBA control vscroll and hscroll in a frame (https://www.excelbanter.com/excel-programming/362665-vba-control-vscroll-hscroll-frame.html)

Gary

VBA control vscroll and hscroll in a frame
 
I need to be able to position the vertical and horizontal scroll bars in a
Fame object from VBA. I have searched the internet for an API or code o do
this without success. The only frame routine (scroll) doesn't seem to do
this. Any help would be appreciated.

Gary


[email protected]

VBA control vscroll and hscroll in a frame
 
Hi Gary,

I am not sure I got your point, but you can use the ScrollTop
(Vertical) and ScrollWidth (Horizontal) property to position them. Of
course, you should know the values (in design mode) to do so and also
you should set the Setfocus method to the adjacent object (textbox,
command button, checkbox, etc).

myFrame.ScrollTop = 1176
myFrame.ScrollWidth = 600
myTextBox.SetFocus

I hope this helps.
Karim


[email protected]

VBA control vscroll and hscroll in a frame
 
Please use scrollLeft and not scrollWidth.

ScrollWidth set the width limit for the Frame and ScrollHeight the
height limit.

Regards,
Karim


Gary

VBA control vscroll and hscroll in a frame
 
Karim,

I have a WebBrowserObject in a Frame and I need to be able to control from
VBA the position of the scrollbars so the WebBrowser shows what I want. The
scrollbars in the Frame do not appear to be controllable from a VB
application unlike scroll bars you can add to an object. If I try to add my
own scrollbars to the frame it has no affect on the WebBrowser. Hope that
makes sense.

Gary


" wrote:

Hi Gary,

I am not sure I got your point, but you can use the ScrollTop
(Vertical) and ScrollWidth (Horizontal) property to position them. Of
course, you should know the values (in design mode) to do so and also
you should set the Setfocus method to the adjacent object (textbox,
command button, checkbox, etc).

myFrame.ScrollTop = 1176
myFrame.ScrollWidth = 600
myTextBox.SetFocus

I hope this helps.
Karim



[email protected]

VBA control vscroll and hscroll in a frame
 
Hello again,

I made an example where you can see how you can programmatically
control the scrollbars in a Frame1. I think this would be better. If
you wish I can send it to your email address.

Regards,
Karim


Gary

VBA control vscroll and hscroll in a frame
 
karim,

I would be very grateful to see a real example. Please do send to my email
address.

Thanks for your interest,

gary

" wrote:

Hello again,

I made an example where you can see how you can programmatically
control the scrollbars in a Frame1. I think this would be better. If
you wish I can send it to your email address.

Regards,
Karim



[email protected]

VBA control vscroll and hscroll in a frame
 
Is this your email -- gary @ discussions . microsoft . com (I added
the spaces as an anti spamming precaution) ?


[email protected]

VBA control vscroll and hscroll in a frame
 
I Sent the file to your mailbox.

Regards,
Karim


Benabd

VBA control vscroll and hscroll in a frame
 
Hello,

For the benefit of all, here is a description of the program that
worked for Gary.

Create a UserForm1 and add the following objects to it:

A Frame name it as Frame1 with ScrollHeight = 300 and ScrollWidth = 480
A Slider name it as SliderV with Max = 300
A Slider name it as SliderH with Max = 480
A Label name it as V
A Label name it as H

In the code area of the UserForm1 paste the following code:
Private Sub SliderH_Change()
Frame1.ScrollLeft = SliderH.Value
H.Caption = SliderH.Value
End Sub

Private Sub SliderV_Change()
Frame1.ScrollTop = SliderV.Value
V.Caption = SliderV.Value
End Sub

Now, you can control the Frame1 scrollbars using the sliders.

Regards,
Karim


Benabd

VBA control vscroll and hscroll in a frame
 
Hello,

For the benefit of all, here is a description of the program that
worked for Gary.

Create a UserForm1 and add the following objects to it:

A Frame name it as Frame1 with ScrollHeight = 300 and ScrollWidth = 480
A Slider name it as SliderV with Max = 300
A Slider name it as SliderH with Max = 480
A Label name it as V
A Label name it as H

In the code area of the UserForm1 paste the following code:
Private Sub SliderH_Change()
Frame1.ScrollLeft = SliderH.Value
H.Caption = SliderH.Value
End Sub

Private Sub SliderV_Change()
Frame1.ScrollTop = SliderV.Value
V.Caption = SliderV.Value
End Sub

Now, you can control the Frame1 scrollbars using the sliders.

Regards,
Karim



All times are GMT +1. The time now is 12:25 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com