Results 1 to 13 of 13
  1. #1
    Lounger
    Join Date
    Jun 2001
    Posts
    31
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Word Restore AutoExec Macro (Word 9.0 SR-1)

    Tried the code in your WOW #6.31 Item #3. Very limited testing (3 docs, without imbedded bookmarks) found some interesting things:

    [1] The Macro Editor does not put the "Public" in the "Public Sub AutoExec() line.

    Not to worry having "Public" in the code seems to make no nevermind (at least in Word 9.0 SR-1). I ran it with and without the "Public" keyword with the same three docs.

    [2] The GOTO a.k.a., "Application.GoBack" command has done the following:
    With a one page doc: it goes to the top of page one.
    With a two page doc: it goes to the bottom of page two.
    With a ten page doc: it goes to the top of page one.

    Conculsion:
    "RecentFiles(1).Open" works all the time.
    "Application.GoBack" seems to have a mind of its own in Word 9.0 SR-1

  2. #2
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Yilgarn region of Toronto, Ontario
    Posts
    5,453
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Word Restore AutoExec Macro (Word 9.0 SR-1)

    Please see the attached file.

    ' This set of macros will execute automatically whenever you Open, Close or Save a document.
    ' AutoClose, as an example, checks to see if the document is "dirty", that is, if it has changed since it was opened.
    ' If the document has changed, AutoClose puts a bookmark "last" wherever the text cursor happens to be.
    Attached Files Attached Files

  3. #3
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Dublin, Ireland, Republic of
    Posts
    2,697
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: Word Restore AutoExec Macro (Word 9.0 SR-1)

    Chris,

    Does Shift F5 not do something similar when a document is opened, i.e. take you to the last edit point ?

    Just curious ?

    Andrew C

  4. #4
    Lounger
    Join Date
    Jun 2001
    Posts
    31
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Word Restore AutoExec Macro (Word 9.0 SR-1)

    Not in the latest DOC that I worked with this morning.

    I have no idea what [Shift F5] is supposed to do.

  5. #5
    Lounger
    Join Date
    Jun 2001
    Posts
    31
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Word Restore AutoExec Macro (Word 9.0 SR-1)

    G'day, Chris, and thanks for the response.

    It appears that your code will work on all but the fault that I found with the original code in WOW #6.31 Item #3. Try this on for size.

    When the last DOC opened is an Outlook e-mail attachment the code will fault. When an attachment is opened a TEMP file is created by Ms. Word. When you exit from Ms. Word the TEMP tile is deleted. Ms. Word cannot find the TEMP file that no longer exists. The result is:

    Run-time error

  6. #6
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Yilgarn region of Toronto, Ontario
    Posts
    5,453
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Word Restore AutoExec Macro (Word 9.0 SR-1)

    It appears that your code will work on all but the fault that I found with
    the original code in WOW #6.31 Item #3. Try this on for size.

    When the last DOC opened is an Outlook e-mail attachment the code will

    Oh. Confession #1: I don't use Outlook. Confession #2: I fire up all instances of Word97SR2 with a DOs Batch file (which copies a secure file over Normal.dot and does other stuff). I suppose I could add code to that that actually LOOKED for the temp file, whatever it is, using a fast file-finder, such as FF.COM, and then passed that file name as a parameter on the command line.

    However, your solution of using VBA to examine the RecentList is better (in the sense that it is within Word). How can you be sure that it is that specific "recent" that you want?

    On another world, I use a macro to fire up VBE and maximize the window after pointing it all at a template (also increments the template number from Utils132.dot to Utils123.dot etc), and the simple code actually corrupts the RecentList, somehow.

    The RecentList seems quite flaky.


    If I really HAD to have it, i'd do something more general, such as writing the file name to a INI file, and having the Auto macro read back from the INI file. That way I know with what I'm dealing.

  7. #7
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Yilgarn region of Toronto, Ontario
    Posts
    5,453
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Word Restore AutoExec Macro (Word 9.0 SR-1)

    > Shift F5 not do something similar

    Apparently not always. I have wondered from time to time what it is that the SHiftF5 sees. It seems to me that sometimes moving the text cursor around doesn't trigger the correct behaviour form ShiftF5.

    I reassure you that I really do move the text cursor - I'm not talking about scrolling the document with the mouse/scroll bar.

  8. #8
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Yilgarn region of Toronto, Ontario
    Posts
    5,453
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Word Restore AutoExec Macro (Word 9.0 SR-1)

    Are you still looking for a solution?

    I have written "udfLatest" which creates a bookmark at the current selection point in the current document, stores the bookmark name (local to the document) and the document name (local to the computer) in a macro, (pauses for breath), builds a macro to open that file and jump to that macro (pant, pant) and then adds that macro to NewMacros (creating, in Normal.dot, NewMacros module if it didn't already exist) and then (gasp!!) adds a call to that macro to the foot of the Files list.

    Works for me on documents and templates in Word97SR2.

    Let me know if you'd like to try it and I'll post the code in the VBA forum or make it available for d/l from my web pages.

  9. #9
    Lounger
    Join Date
    Jun 2001
    Posts
    31
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Word Restore AutoExec Macro (Word 9.0 SR-1)

    Thank you for the prompt reply, Chris. I would like to download the VBA code and run it 'barefoot' [with no modifications] from your web site. I would try it with

  10. #10
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Yilgarn region of Toronto, Ontario
    Posts
    5,453
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Word Restore AutoExec Macro (Word 9.0 SR-1)

    Try <A target="_blank" HREF=http://www.vif.com/users/cgreaves/Latest.htm>this</A>. It's a crude draft ...... but then, it's an ill wind .....

    That's a version that works for the time being by the user clicking a button. Woody, however, asks "Does it work no matter how you exit Word?", and the answer is "It soon will".

    I have a meeting with my accountant this afternoon, so I can use that time to mull over a passive scheme that does not depend on the exit-from-Word, in any form of the event, for storage of the restart point. Woody continues "It's amazingly difficult to trap Word's exit.", so my plan is to avoid that difficulty by not depending on Word's exit.

    "Avoiding the problem" is just another way of saying "lazy", which describes my entry into computing.



    >documents in two places that may not be the norm:

    Right now if the code can't find the file, it just does nothing. Not a whimper. Not a MsgBox. Zilch.

    I have plans for automatic garbage collection, so that invocation of any claim to a past document generates a quick check on all historic links, and removes those which are no longer valid.

    All of this starts to sound like an application, and pretty soon I'll have replaced most of Word .....

    I could move "unattainable documents" to a separate menu item, to be reclaimed when the documents were once more available. Again, done automatically undercover.

  11. #11
    Lounger
    Join Date
    Jun 2001
    Posts
    31
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Word Restore AutoExec Macro (Word 9.0 SR-1)

    Sorry about the delay - there is this silly thing called work.

    Have you a newer version of the Restore AutoExec Macro?

    BTW: The last that I tried to run triggered an error message. Security considerations, and all that. So, I will have to cut and paste to get the code into Ms. Word's normal.dot collection of macros.

    Thanks for the bandwidth and for taking the time.

  12. #12
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Yilgarn region of Toronto, Ontario
    Posts
    5,453
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Word Restore AutoExec Macro (Word 9.0 SR-1)

    No, I don't have a newer version. Woody suggested I wait for the next issue wherin he will revela more dank secrets and asked me to see if I could cope with thse soon-to-be-revealed situations, so I'm waiting on Woody to raise the bar of the hurdle.

    I will try to remember to re-post my riposte to him here.

  13. #13
    Lounger
    Join Date
    Jun 2001
    Posts
    31
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Word Restore AutoExec Macro (Word 9.0 SR-1)

    Okay, I will wait. Meanwhile, good luck in your quest.

    Am tempted to try cut-n-paste on the previous text file again to see if it will run.

    CUL TKS

Posting Permissions

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