Results 1 to 4 of 4
  1. #1
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Trapping error in debug.. (2000)

    Attached is my code.
    Dubt on:
    1) If i break code during debug, with esc or ctrl esc and have opened one .DOC in dir have the DOC with ~.
    For the next use the macro tell me "the file is use from..."
    2) For one or more reason i breack the code during the macro work and the DOC is opened but not close in dir have the DOC with ~.

    How to trapping this error?

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

    Re: Trapping error in debug.. (2000)

    The file whose name starts with ~$ contains the name of the user who has opened the document. Word will automatically delete this file when the document is closed, but the file will remain behind if Word crashes or if you stop code execution before the document was closed. If you need to debug the code, you should always make sure that the lines

    MODULO.ActiveDocument.Close wdDoNotSaveChanges
    MODULO.Quit wdDoNotSaveChanges

    are executed. When execution is paused, you can drag the yellow arrow in the left margin of the code module to the first of these lines, then single-step through them by pressing F8 twice.

    If a ~$ file is left behind because Word crashed, you should be able to delete it without problems.

  3. #3
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Trapping error in debug.. (2000)

    ..ok but after i have printed the DOC is correct to insert this 2 lines or not?

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

    Re: Trapping error in debug.. (2000)

    Sorry, I don't understand. Those lines are already in your code.

Posting Permissions

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