none
How to control the scrollbar of Excel WorkSheet RRS feed

  • Question

  • I  using c# to display so many columns in a workseet , so I want to scroll the workseet to right ,
    How to do this ? Are there any examples?

    Thank you very much!
    Sunday, July 29, 2007 7:27 PM

Answers

  • Here's the info from the VBA object model Help file. The ActiveWindow object used in the sample code is a property of the Application object.

     

    ScrollIntoView Method

     
     

    Scrolls the document window so that the contents of a specified rectangular area are displayed in either the upper-left or lower-right corner of the document window or pane (depending on the value of the Start argument).

    expression.ScrollIntoView(Left, Top, Width, Height, Start)

    expression    An expression that returns a Pane or Window object.

    Left    Required Long. The horizontal position of the rectangle (in points) from the left edge of the document window or pane.

    Top    Required Long. The vertical position of the rectangle (in points) from the top of the document window or pane.

    Width    Required Long. The width of the rectangle, in points.

    Height    Required Long. The height of the rectangle, in points.

    Start    Optional Variant. True to have the upper-left corner of the rectangle appear in the upper-left corner of the document window or pane. False to have the lower-right corner of the rectangle appear in the lower-right corner of the document window or pane. The default value is True.

    Remarks

    The Start argument is useful for orienting the screen display when the rectangle is larger than the document window or pane.

    Example

    This example defines a 100-by-200-pixel rectangle in the active document window, positioned 20 pixels from the top of the window and 50 pixels from the left edge of the window.The example then scrolls the document up and to the left so that the upper-left corner of the rectangle is aligned with the upper-left corner of the window.

    ActiveWindow.ScrollIntoView _
        Left:=50, Top:=20, _
        Width:=100, Height:=200
    
    Wednesday, August 1, 2007 8:49 PM
    Moderator

All replies

  • Look at the ScrollIntoView method of the Window object.

    Monday, July 30, 2007 4:18 PM
    Moderator
  • Hi , I cannot find the reference of ScrollIntoView , Could you give me a example ?

    Thank you !
    Wednesday, August 1, 2007 7:02 PM
  • Here's the info from the VBA object model Help file. The ActiveWindow object used in the sample code is a property of the Application object.

     

    ScrollIntoView Method

     
     

    Scrolls the document window so that the contents of a specified rectangular area are displayed in either the upper-left or lower-right corner of the document window or pane (depending on the value of the Start argument).

    expression.ScrollIntoView(Left, Top, Width, Height, Start)

    expression    An expression that returns a Pane or Window object.

    Left    Required Long. The horizontal position of the rectangle (in points) from the left edge of the document window or pane.

    Top    Required Long. The vertical position of the rectangle (in points) from the top of the document window or pane.

    Width    Required Long. The width of the rectangle, in points.

    Height    Required Long. The height of the rectangle, in points.

    Start    Optional Variant. True to have the upper-left corner of the rectangle appear in the upper-left corner of the document window or pane. False to have the lower-right corner of the rectangle appear in the lower-right corner of the document window or pane. The default value is True.

    Remarks

    The Start argument is useful for orienting the screen display when the rectangle is larger than the document window or pane.

    Example

    This example defines a 100-by-200-pixel rectangle in the active document window, positioned 20 pixels from the top of the window and 50 pixels from the left edge of the window.The example then scrolls the document up and to the left so that the upper-left corner of the rectangle is aligned with the upper-left corner of the window.

    ActiveWindow.ScrollIntoView _
        Left:=50, Top:=20, _
        Width:=100, Height:=200
    
    Wednesday, August 1, 2007 8:49 PM
    Moderator