Results 1 to 3 of 3
  1. #1
    2 Star Lounger
    Join Date
    Feb 2001
    Location
    Eugene, Oregon, USA
    Posts
    110
    Thanks
    0
    Thanked 0 Times in 0 Posts

    VB Error on ActiveDocument.Close

    Using Word2000(SR-1), I have a macro that sends a document as an e-mail to a specific person and then closes the document ("ActiveDocument.Close").

    I can step through the code without error; however, when I attempt to run the code, VB gives me a Run-Time Error '4198' (Command Failed). If I debug the error and simply restart the macro at the break point, it proceeds without error.

    Do I need to have some sort of "Wait" command?

  2. #2
    JustCallMeAl
    Guest

    Re: VB Error on ActiveDocument.Close

    Put in a counter/timer before the ActiveDocument.Close and see if it helps. Something like:

    <pre>for intCounter = 1 to 10000 ' Increase that number as needed
    next intCounter
    </pre>


    Just a thought.

  3. #3
    2 Star Lounger
    Join Date
    Feb 2001
    Location
    Eugene, Oregon, USA
    Posts
    110
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: VB Error on ActiveDocument.Close

    Thanks Al. My initial thoughts that I needed a timer were evidently incorrect.

    The problem was that the macro was executed from an "On Entry" event into a Word form field. Evidently, on entering a word form field, the field remains active which prevents the ActiveDocument.Close command from functioning properly. I changed the way the macro is executed to a macro button and now it seems to be working correctly!

    Nonetheless, thanks for your help!

Posting Permissions

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