Suppress Prompt

L

Lynn

I have created a macro that performs some actions & then closes the active
file. I would like to suppress the prompt that appears when the file closes
"Do you want to save the changes to Document X?" (ie close the file without
saving any changes) Is this possible? If so, how?
 
J

Jay Freedman

Lynn said:
I have created a macro that performs some actions & then closes the
active file. I would like to suppress the prompt that appears when
the file closes "Do you want to save the changes to Document X?" (ie
close the file without saving any changes) Is this possible? If so,
how?

There's an optional argument to the Close method that controls that. Try
this:

ActiveDocument.Close SaveChanges:=wdDoNotSaveChanges

--
Regards,
Jay Freedman
Microsoft Word MVP
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.
 
L

Lynn

Thanks Jay. Your suggestion worked for this situation. Is there a general
statement to supress any prompts that may pop up (ie it can be used in any
situation)?
 
J

Jay Freedman

There is a property, Application.DisplayAlerts, that you can set to the value
wdAlertsNone to suppress "certain alerts and messages" (in the words of the VBA
help topic). This won't suppress _all_ prompts, but it's worth a try.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top