+ Reply to Thread
Results 1 to 10 of 10

VBA control vscroll and hscroll in a frame

  1. #1
    gary
    Guest

    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


  2. #2

    Re: 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


  3. #3

    Re: 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


  4. #4
    gary
    Guest

    Re: 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


    "[email protected]" 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
    >
    >


  5. #5

    Re: 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


  6. #6
    gary
    Guest

    Re: 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

    "[email protected]" 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
    >
    >


  7. #7

    Re: 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) ?


  8. #8

    Re: VBA control vscroll and hscroll in a frame

    I Sent the file to your mailbox.

    Regards,
    Karim


  9. #9
    Benabd
    Guest

    Re: 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


  10. #10
    Benabd
    Guest

    Re: 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


+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1