Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / April 2007

Tip: Looking for answers? Try searching our database.

macro to close the active window without saving the document

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
sales@elchoartcraft.com - 16 Apr 2007 02:07 GMT
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
Brian - 16 Apr 2007 09:54 GMT
Add the following at the end:

Application.Quit

Hope it helps,

Signature

Brian McCaffery

> I'm trying to write a macro that closes the active window without
> saving the document. The one line of code is:
[quoted text clipped - 8 lines]
> Thanks
> Steve
sales@elchoartcraft.com - 17 Apr 2007 07:00 GMT
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

> Add the following at the end:
>
[quoted text clipped - 20 lines]
>
> - Show quoted text -
Tony Jollans - 17 Apr 2007 12:03 GMT
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

Signature

Enjoy,

Tony Jollans
Microsoft Word MVP

> That does the job but it also closes every word document window which
> could be disasterous. I just want to close the Active Window.
[quoted text clipped - 26 lines]
>>
>> - Show quoted text -
Tony Jollans - 17 Apr 2007 13:34 GMT
Oops! That should of course be ...

   If Documents.Count = 0 then Application.Quit

Signature

Enjoy,

Tony Jollans
Microsoft Word MVP

> 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
[quoted text clipped - 32 lines]
>>>
>>> - Show quoted text -
sales@elchoartcraft.com - 19 Apr 2007 08:00 GMT
Thankyou. that's perfect.

On Apr 17, 9:34 pm, "Tony Jollans" <My forename at my surname dot com>
wrote:
> Oops! That should of course be ...
>
[quoted text clipped - 52 lines]
>
> - Show quoted text -
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.