Results 1 to 2 of 2
  1. #1
    4 Star Lounger
    Join Date
    Jan 2001
    Location
    Richmond, Virginia, USA
    Posts
    416
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Macro question suppressing dialog box (2002 SP-2)

    This is probably a very easy question, but I just don't know where to find the answer. I have a macro that copies text from a document then closes that document. When it closes the document, it prompts you to save the document. If you answer yes or no to the save prompt, it continues with the macro. How do I make Word automatically select Yes (or No, since it doesn't seem to matter) so I don't have to see that dialog box?

    Here's what my macro says:

    ActiveDocument.Close

    Should it say something else, instead, or do I just need to add something?

    Thanks,
    Becky

  2. #2
    Plutonium Lounger
    Join Date
    Nov 2001
    Posts
    10,550
    Thanks
    0
    Thanked 7 Times in 7 Posts

    Re: Macro question suppressing dialog box (2002 SP-2)

    Just add SaveChanges as in

    ActiveDocument.Close SaveChanges:=False

    If you want to check whether the document has already been saved then look at ActiveDocument.Saved, and to do the whole thing in one command then try

    ActiveDocument.Close SaveChanges:=Not ActiveDocument.Saved

    This will save the document if it hasn't already been saved.

    StuartR

Posting Permissions

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