如何从Microsoft Excel获取滚动位置

使用Microsoft Office自动化时,我想将图像插入电子表格中。 如何确定当前用户的滚动位置?

在Excel中,您可以使用Window对象的VisibleRange属性,即

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 

希望有所帮助

祝你好运MikeD