How to determine the current position of an open .xls file?



Hello, friends,

We automate Excel from Once a .xls file is openned, users may work
on any part of it.

When this .xls file is closed, our app needs to remember the current
position, such as current workSheet, current row number, current column
number, etc. When our app opens this .xls file next time, it will go to that
position directly so that users may continue.

But, how to determine current row number, and etc. I looked up those
properties/methods, none of them look like for this job: I could not find
ActiveCell property in worksheet, for instance.

Any reference paper or sample source code? Thanks a lot.


When the workbook is saved, Excel "remembers" the activesheet and activecell.
So, you can use the ActiveSheet and ActiveCell objects. As a test, put this
in the workbook code module:

Private Sub Workbook_Open()
MsgBox "Current location: " & ActiveSheet.Name & "!" & ActiveCell.Address
End Sub


Those .xls files are read only. When users work on a .xls file, he/she may
click Bookmark button in our app to bookmark wherever he/she is currently
working on. Our app then will get the current position and save them into

Next time users open the same .xls again (read only), our app will list all
bookmarks to allow users to "jump onto" that position by doubl-clicking one
of them.

Any ideas? Thanks a lot.

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question