Hi Shauna,
Hi SvenC
You can get information about the cursor position through
Application.Selection.Range.Information(). Look up VBA's help for all
the parameters that .Information can take and what they return.
However, there's no need to save the information. When you open a Word
document, do Shift-F5. That returns the insertion point to where it
was when you saved the document. You can achieve the same thing in
VBA using Application.GoBack
Neither Shift+F5 nor GoBack is working for me in Word 2007. I tried this
VBA:
sFile = ActiveDocument.FullName
ActiveDocument.Close
Set odoc = Application.Documents.Open(sFile)
Application.GoBack
But the document is opened with the beginning shown, no movement by calling
GoBack or pressing Shift+F5
The Information Method was how I got the current page, but unfortunately it
is not giving the current line, only the line relative to the page.
But when I use Goto, to go to an absolute page and from there to a relative
line the caret is always position on the absolute line from the beginning.
I was able to take the Selection Start and End properties and use
oDoc.Range(start, end).Select to position the insertion mark correctly. Now
only the scrolling position is not as before. I can get the scrolling
postion of the current window in percent but unfortunately the document is
loaded step by step so right after the Documents.Open call the scrolling bar
is not exact as the document and its statistics (number of pages,
characters...) is loaded in the background.
But with the insertion point being correct it is quite OK for me.
Thanks,
SvenC