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

RE: macro to close the active window without saving the document by Brian

Brian
Mon Apr 16 03:54:01 CDT 2007

Add the following at the end:

Application.Quit

Hope it helps,

--
Brian McCaffery


"sales@elchoartcraft.com" wrote:

> 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
>
>

Re: macro to close the active window without saving the document by sales

sales
Tue Apr 17 01:00:15 CDT 2007

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

On Apr 16, 5:54 pm, Brian <B...@discussions.microsoft.com> wrote:
> Add the following at the end:
>
> Application.Quit
>
> Hope it helps,
>
> --
> Brian McCaffery
>
>
>
> "s...@elchoartcraft.com" wrote:
> > 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- Hide quoted text -
>
> - Show quoted text -



Re: macro to close the active window without saving the document by Tony

Tony
Tue Apr 17 06:03:02 CDT 2007

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

--
Enjoy,

Tony Jollans
Microsoft Word MVP

<sales@elchoartcraft.com> wrote in message
news:1176789615.889610.109710@y80g2000hsf.googlegroups.com...
> 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
>
> On Apr 16, 5:54 pm, Brian <B...@discussions.microsoft.com> wrote:
>> Add the following at the end:
>>
>> Application.Quit
>>
>> Hope it helps,
>>
>> --
>> Brian McCaffery
>>
>>
>>
>> "s...@elchoartcraft.com" wrote:
>> > 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- Hide quoted text -
>>
>> - Show quoted text -
>
>



Re: macro to close the active window without saving the document by Tony

Tony
Tue Apr 17 07:34:17 CDT 2007

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
news:%239UJ7$NgHHA.4368@TK2MSFTNGP06.phx.gbl...
> 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
>
> --
> Enjoy,
>
> Tony Jollans
> Microsoft Word MVP
>
> <sales@elchoartcraft.com> wrote in message
> news:1176789615.889610.109710@y80g2000hsf.googlegroups.com...
>> 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
>>
>> On Apr 16, 5:54 pm, Brian <B...@discussions.microsoft.com> wrote:
>>> Add the following at the end:
>>>
>>> Application.Quit
>>>
>>> Hope it helps,
>>>
>>> --
>>> Brian McCaffery
>>>
>>>
>>>
>>> "s...@elchoartcraft.com" wrote:
>>> > 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- Hide quoted text -
>>>
>>> - Show quoted text -
>>
>>
>
>



Re: macro to close the active window without saving the document by sales

sales
Thu Apr 19 02:00:56 CDT 2007

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 ...
>
> If Documents.Count = 0 then Application.Quit
>
> --
> Enjoy,
>
> Tony Jollans
> Microsoft Word MVP
>
> "Tony Jollans" <My forename at my surname dot com> wrote in messagenews:%239UJ7$NgHHA.4368@TK2MSFTNGP06.phx.gbl...
>
>
>
> > 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
>
> > --
> > Enjoy,
>
> > Tony Jollans
> > Microsoft Word MVP
>
> > <s...@elchoartcraft.com> wrote in message
> >news:1176789615.889610.109710@y80g2000hsf.googlegroups.com...
> >> 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
>
> >> On Apr 16, 5:54 pm, Brian <B...@discussions.microsoft.com> wrote:
> >>> Add the following at the end:
>
> >>> Application.Quit
>
> >>> Hope it helps,
>
> >>> --
> >>> Brian McCaffery
>
> >>> "s...@elchoartcraft.com" wrote:
> >>> > 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- Hide quoted text -
>
> >>> - Show quoted text -- Hide quoted text -
>
> - Show quoted text -