How do I get the scroll position from Microsoft Ex

2019-06-14 07:46发布

When using Microsoft office automation I want to insert images into a spreadsheet. How can I determine the current users scroll location?

1条回答
劳资没心,怎么记你
2楼-- · 2019-06-14 08:30

In Excel you may use the VisibleRange property of the Window object, i.e.

Private Sub DirtyTest()
Dim MyW As Window, TopRow As Long, TopCol As Long

    Set MyW = Windows(1)                ' index 1 always refers to the window displayed
    TopRow = MyW.VisibleRange.Cells.Row
    TopCol = MyW.VisibleRange.Cells.Column

    ' any other code

End Sub

Hope that helps

Good luck MikeD

查看更多
登录 后发表回答