Results 1 to 14 of 14
  1. #1
    New Lounger
    Join Date
    Apr 2001
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Where I left off (97 )

    Hey Masters of the Word:
    In WordPerfect (sorry), there was a nifty feature by which the program would (at your direction) put you back on the page and put the cursor in the spot where you left off the next time you opened the document. This was especially helpful when editing long documents over a period of days, or when multi-tasking. I found it saved a great deal of time. Is there a Word equivalent? And for the guy who typically responds to this sort of question with the answer "Yes"--what is the Word equivalent or workaround?

    You folks, even the wiseacre, and this lounge are about the best thing on the internet.
    Gracias

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Where I left off (97 )

    Yep. Shift+F5 will take you back to where you were.

  3. #3
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Where I left off (97 )

    In my previous post, I mentioned the use of Shift+F5 to go back to the last position in your doc.

    Be aware, though, that when you migrate to Word 2000 or Word XP, this doesn't always work. See Woody's Office Watch and Word MVP FAQ for a description of the problem and a solution.

  4. #4
    5 Star Lounger
    Join Date
    Jan 2001
    Location
    Cairns, Queensland, Australia
    Posts
    885
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Where I left off (97 )

    If I save then close the document with the cursor somewhere in the middle, then open it again shift+F5 takes me to the end of the document. Oh, I'm using Word97 SR2. Actually, it does the same if I don't close the document.

    Have I missed something?
    Granville

  5. #5
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Where I left off (97 )

    Could it be DMS integration or some other start-up macro that changes the last edit position?

  6. #6
    5 Star Lounger
    Join Date
    Jan 2001
    Location
    Cairns, Queensland, Australia
    Posts
    885
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Where I left off (97 )

    Thanks for the prompt reply.

    However, we do not have a document management system (I've typed that in full just in case DMS has another meaning). I also turned off all the startup macros and closed and restart Word with the same results.

    It is specific to my PC, as it works for two others at this site. Oh well, it's not important for me but will be useful to the rest. <img src=/S/shrug.gif border=0 alt=shrug width=39 height=15> (Maybe I can use this as leverage to get my laptop upgraded! <img src=/S/evilgrin.gif border=0 alt=evilgrin width=15 height=15>)
    Granville

  7. #7
    Super Moderator
    Join Date
    Jan 2001
    Location
    Melbourne, Victoria, Australia
    Posts
    3,852
    Thanks
    4
    Thanked 259 Times in 239 Posts

    Re: Where I left off (97 )

    Word's Last Edit position defines the position of the last EDIT - not the last position of the cursor in the file. If you want to mark the last cursor position then you would need to create a macro to make a change at that position (and undo it) when you are exiting the file. Alternately the macro could create a temporary bookmark at that position and when opening the file you could kick off the GoTo to hit that bookmark. That way you could get back the same selection as well.

    I guess tying either of these macro options to the FileSave automacro would do the job.
    Andrew Lockton, Chrysalis Design, Melbourne Australia

  8. #8
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Where I left off (97 )

    We could create a whole new class of metadata

  9. #9
    Super Moderator
    Join Date
    Dec 2000
    Location
    New York, NY
    Posts
    2,970
    Thanks
    3
    Thanked 29 Times in 27 Posts

    Re: Where I left off (97 )

    Another alternative: define a custom document property (of number type) called "LastCursorPos", and have code like this run whenever the document is closed:

    Dim lngCursorPos As Long
    lngCursorPos = Selection.Start
    ActiveDocument.CustomDocumentProperties("LastCurso rPos") = lngCursorPos

    and run the same code whenever the document is opened, but with the statements (and the assignments in each statement) swapped.

    Gary

  10. #10
    3 Star Lounger
    Join Date
    Jun 2001
    Location
    Los Angeles, California, USA
    Posts
    289
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Where I left off (97 )

    Naw, don't tell me Word is still playing "catch-up" with WP (and not very well). I'm shocked -- and you have to use code to do it too!Astonishing. ...wistful memories of WordPerfect and "goto goto" (remember last position...) Let's not talk about numbering or footnoting, still.

  11. #11
    Silver Lounger
    Join Date
    Jan 2001
    Location
    West Long Branch, New Jersey, USA
    Posts
    1,921
    Thanks
    6
    Thanked 9 Times in 7 Posts

    Re: Where I left off (97 )

    Gary,

    I had saved your post on this to use in my computer club. So now I'm preparing my presentation for Tuesday (May 28). I doing this in Word 97 on Win 98.

    The save part is working fine. I put your code in a close routine associated with the document. I can step thru the steps of the macro and see the position (BTW: what does the value being saved represent - a char position?).

    When I re-open the document, using an Open routine associated with the document, nothing much seems to happen. I think I got the statements and assignments swapped around ok as such:
    <pre>Dim lngCursorPos As Long, rng As Range
    lngCursorPos = ActiveDocument.CustomDocumentProperties("LastCurso rPos")
    Selection.Start = lngCursorPos
    </pre>


    I checked the property and it certainly seems to have been updated. However, on open, the doc is positioned at the beginning although I don't see an insertion point. If I use the vertical scroll bar, it seems the insertion point is at where the insertion point was when the doc was closed (or 1 char past there). I tried playing with some Move methods so that the doc is positioned to where the insertion point was when it was closed - to no avail. So even if the insertion point is at the right place on open, you need to position the doc to be able to see it.

    Would appreciate any help on this so I can include this for my computer club.

    Thks.

    Fred

  12. #12
    Super Moderator
    Join Date
    Dec 2000
    Location
    New York, NY
    Posts
    2,970
    Thanks
    3
    Thanked 29 Times in 27 Posts

    Re: Where I left off (97 )

    Hi Fred,

    That's what I get for firing off a suggestion without testing it!
    I get the same result you do.
    However the following does seem to work OK (in the code that runs when the doc opens):

    Dim lngCursorPos As Long
    lngCursorPos = ActiveDocument.CustomDocumentProperties("LastCurso rPos")
    ActiveDocument.Characters(lngCursorPos).Select
    Selection.Collapse

    (And yes, "lngCursorPos" represents the index in the document, of the first character in the selection.)

    But now I'm stuck on another problem here, which is that the code that is supposed to set the value of the custom document property, when the document closes, actually doesn't work! For example, if I have a procedure like this:

    Sub UpdateTheDocProp()
    Dim lngCursorPos As Long
    lngCursorPos = Selection.Start
    ActiveDocument.CustomDocumentProperties("LastCurso rPos").Value = lngCursorPos
    End Sub

    - that will work successfully to update the value of the custom document property.
    But if I put those same lines of code into an AutoClose procedure, the value of the custom document property does update, but it is not retained when the document closes! For ex:

    Dim lngCursorPos As Long
    lngCursorPos = Selection.Start
    ActiveDocument.CustomDocumentProperties("LastCurso rPos").Value = lngCursorPos
    'This will give the correct value, but the value is not retained after the doc closes:
    MsgBox ActiveDocument.CustomDocumentProperties("LastCurso rPos").Value

    This seems buggy to me at first glance, and am not sure what is causing it. Unless a workaround for this problem can be found, you're best off going with the suggestion Andrew made, which is to have code run which inserts a bookmark when the document closes, and goes to that bookmark when the document is opened - very straightforward and it should work fine - post back if you need help with code to do that.

    Gary

  13. #13
    Silver Lounger
    Join Date
    Jan 2001
    Location
    West Long Branch, New Jersey, USA
    Posts
    1,921
    Thanks
    6
    Thanked 9 Times in 7 Posts

    Re: Where I left off (97 )

    Gary,

    I played around with this a bit more (Word 97 and Win 98). Here are my findings:

    Putting your revised code into close/open routines associated with the document (not even the template) worked in that the code ran.

    One of the things I found that suggests the bookmark approach is better is that if you just open the document, reposition the insertion point, and close it, it seems nothing changes. Next time you open the document, you are NOT at where you positioned the insertion point. This probably has to do with the document not being dirtied, altho I would have thought it would be even just by changing the value of the custom property.

    Why do you write the following:
    lngCursorPos = Selection.Start
    ActiveDocument.CustomDocumentProperties("LastCurso rPos").Value = lngCursorPos

    instead of
    ActiveDocument.CustomDocumentProperties("LastCurso rPos").Value = Selection.Start


    Also some weird behavior on opening. The cursor actually was positioned, sometimes, 1 character left or right of where I had left it. I checked everything when closing (put in a break point just before the End Sub) and looked at the custom property value, the immediate window for Selection.Start, and the variables in the routine. All read 532. On opening, the property still was 532 but the immediate window showed 533 and the cursor was positioned 1 character right of where I left it. Sometimes it was 1 char left and mostly right on the money. However, I didn't do as rigorous checking of values except for the one case.

    On the bookmarks, I recorded my own macro just by turning on the macro recorder for adding a bookmark and deleting/going to a bookmark. Then I just put the code in the proper routines. I think, given the above and all your issues, this is the way to go.

    Thanks alot.

    Fred

  14. #14
    Super Moderator
    Join Date
    Dec 2000
    Location
    New York, NY
    Posts
    2,970
    Thanks
    3
    Thanked 29 Times in 27 Posts

    Re: Where I left off (97 )

    Hi Fred,
    <hr>Why do you write the following:
    lngCursorPos = Selection.Start
    ActiveDocument.CustomDocumentProperties("LastCurso rPos").Value = lngCursorPos

    instead of
    ActiveDocument.CustomDocumentProperties("LastCurso rPos").Value = Selection.Start<hr>
    - as the code currently stands, no good reason! Probably what happened was that in playing around with an earlier attempt at doing it, it was using the value of Selection.Start more than once - as soon as I'm using a value more than once, I want to store it in a variable. Then later I deleted the second usage of the variable but didn't think to go back to plain old Selection.Start (well this sounds plausible, anyway! <img src=/S/grin.gif border=0 alt=grin width=15 height=15>)

    I also saw the flaky behavior with the cursor position ending up off by one; not sure why. All signs point to using bookmarks as being the more reliable way to do this one.

    Gary

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •