macro to close the active window without saving the document

S

sales

I'm trying to write a macro that closes the active window without
saving the document. The one line of code is:
ActiveWindow.Close SaveChanges:=wdDoNotSaveChanges

This macro closes the active document but doesn't close the parent
window. It just leaves the parent window there without a document in
it.

Any ideas?


Thanks
Steve
 
S

sales

That does the job but it also closes every word document window which
could be disasterous. I just want to close the Active Window.

Thanks
Steve
 
T

Tony Jollans

If you have a (parent) Word window without any Documents in it then there
are no other documents which can be closed. Maybe you need to check first
....

If Documents.Count > 0 then Application.Quit
 
T

Tony Jollans

Oops! That should of course be ...

If Documents.Count = 0 then Application.Quit
 
S

sales

Thankyou. that's perfect.

Oops! That should of course be ...

If Documents.Count = 0 then Application.Quit

--
Enjoy,

Tony Jollans
Microsoft Word MVP

"Tony Jollans" <My forename at my surname dot com> wrote in message




- Show quoted text -
 

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