ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Trying to close a window without saving (https://www.excelbanter.com/excel-programming/384390-trying-close-window-without-saving.html)

danhattan

Trying to close a window without saving
 
I have a spreadsheet that runs a macro that switches between it and a second
spreadsheet, merely moving data from the second to the first. The macro then
closes the second spreadsheet. My problem is that it prompts the user to save
before closing, and I want to remove this prompt.

I tried this line: ActiveWindow.Close.Save = False. Purely guessing, but
typed in all lower case and VBA properly capitalized it, which has always
been a sign that I've guessed right or type in variable names correctly.
However, I'm getting the following error: Compile Error: Invalid Qualifier,
and the .Close is highlighted.

Can someone tell me what the statement I'm looking for actually is, and if
you have the time, explain that error to me? Very much appreciated for any
help anyone can offer.

Dan

Bob Umlas

Trying to close a window without saving
 
Application.DisplayAlerts = False
Bob Umlas
Excel MVP

"danhattan" wrote in message
...
I have a spreadsheet that runs a macro that switches between it and a

second
spreadsheet, merely moving data from the second to the first. The macro

then
closes the second spreadsheet. My problem is that it prompts the user to

save
before closing, and I want to remove this prompt.

I tried this line: ActiveWindow.Close.Save = False. Purely guessing, but
typed in all lower case and VBA properly capitalized it, which has always
been a sign that I've guessed right or type in variable names correctly.
However, I'm getting the following error: Compile Error: Invalid

Qualifier,
and the .Close is highlighted.

Can someone tell me what the statement I'm looking for actually is, and if
you have the time, explain that error to me? Very much appreciated for any
help anyone can offer.

Dan




Vergel Adriano

Trying to close a window without saving
 
Try

ActiveWorkbook.Close False

Close.False wouldn't work because Close is a method and not an Object.
ActiveWorkbook is an object and it has properties and methods that you can
access by adding the dot. The Close method takes 3 optional parameters and
the first one is a boolean value to indicate wether or not the changes should
be saved.


"danhattan" wrote:

I have a spreadsheet that runs a macro that switches between it and a second
spreadsheet, merely moving data from the second to the first. The macro then
closes the second spreadsheet. My problem is that it prompts the user to save
before closing, and I want to remove this prompt.

I tried this line: ActiveWindow.Close.Save = False. Purely guessing, but
typed in all lower case and VBA properly capitalized it, which has always
been a sign that I've guessed right or type in variable names correctly.
However, I'm getting the following error: Compile Error: Invalid Qualifier,
and the .Close is highlighted.

Can someone tell me what the statement I'm looking for actually is, and if
you have the time, explain that error to me? Very much appreciated for any
help anyone can offer.

Dan


dkinn

Trying to close a window without saving
 
In addition to the help file, don't forget the simple space bar.

(In Excel03 and XP at least) after I type

Activeworkbook.close and then press the spacebar it gives me a list of the
arguments for that command.
In this case it shows me

Activeworkbook.close

close([savechanges],[filename],[routeworkbook])

to at least show me what options I have available.

Help is my best friend.


David

"Tom Ogilvy" wrote:

in you code, highlight the object and method and hit F1.

for example, if in a code module I highlight

Range("A1").sort and hit F1 I get the help for the sort method of a range
object which includes:

expression.Sort(Key1, Order1, Key2, Type, Order2, Key3, Order3, Header,
OrderCustom, MatchCase, Orientation, SortMethod, DataOption1, DataOption2,
DataOption3)

and an explanation of each argument.

--
Regards,
Tom Ogilvy


"danhattan" wrote:

Thanks Vergel. That worked perfectly.

Another question if you've got the time. I know how to find the
methods/properties by adding the dot after the object, such as Save and
Close. But, how do I then find the parameters to go with the methods? I've
tried using the Object Explorer in VBA but it remains a bit baffling to me.

If you can answer that as well for me, that would be really cool.

In any event, thanks very much for the help you've given me.

Dan

"Vergel Adriano" wrote:

Try

ActiveWorkbook.Close False

Close.False wouldn't work because Close is a method and not an Object.
ActiveWorkbook is an object and it has properties and methods that you can
access by adding the dot. The Close method takes 3 optional parameters and
the first one is a boolean value to indicate wether or not the changes should
be saved.


"danhattan" wrote:

I have a spreadsheet that runs a macro that switches between it and a second
spreadsheet, merely moving data from the second to the first. The macro then
closes the second spreadsheet. My problem is that it prompts the user to save
before closing, and I want to remove this prompt.

I tried this line: ActiveWindow.Close.Save = False. Purely guessing, but
typed in all lower case and VBA properly capitalized it, which has always
been a sign that I've guessed right or type in variable names correctly.
However, I'm getting the following error: Compile Error: Invalid Qualifier,
and the .Close is highlighted.

Can someone tell me what the statement I'm looking for actually is, and if
you have the time, explain that error to me? Very much appreciated for any
help anyone can offer.

Dan


danhattan

Trying to close a window without saving
 
Thanks Vergel. That worked perfectly.

Another question if you've got the time. I know how to find the
methods/properties by adding the dot after the object, such as Save and
Close. But, how do I then find the parameters to go with the methods? I've
tried using the Object Explorer in VBA but it remains a bit baffling to me.

If you can answer that as well for me, that would be really cool.

In any event, thanks very much for the help you've given me.

Dan

"Vergel Adriano" wrote:

Try

ActiveWorkbook.Close False

Close.False wouldn't work because Close is a method and not an Object.
ActiveWorkbook is an object and it has properties and methods that you can
access by adding the dot. The Close method takes 3 optional parameters and
the first one is a boolean value to indicate wether or not the changes should
be saved.


"danhattan" wrote:

I have a spreadsheet that runs a macro that switches between it and a second
spreadsheet, merely moving data from the second to the first. The macro then
closes the second spreadsheet. My problem is that it prompts the user to save
before closing, and I want to remove this prompt.

I tried this line: ActiveWindow.Close.Save = False. Purely guessing, but
typed in all lower case and VBA properly capitalized it, which has always
been a sign that I've guessed right or type in variable names correctly.
However, I'm getting the following error: Compile Error: Invalid Qualifier,
and the .Close is highlighted.

Can someone tell me what the statement I'm looking for actually is, and if
you have the time, explain that error to me? Very much appreciated for any
help anyone can offer.

Dan


danhattan

Trying to close a window without saving
 
Thanks very much, Bob. Would I put that statement before the
ActiveWindow.Close statement? Seems like I would, but please let me know. And
thanks again.

"Bob Umlas" wrote:

Application.DisplayAlerts = False
Bob Umlas
Excel MVP

"danhattan" wrote in message
...
I have a spreadsheet that runs a macro that switches between it and a

second
spreadsheet, merely moving data from the second to the first. The macro

then
closes the second spreadsheet. My problem is that it prompts the user to

save
before closing, and I want to remove this prompt.

I tried this line: ActiveWindow.Close.Save = False. Purely guessing, but
typed in all lower case and VBA properly capitalized it, which has always
been a sign that I've guessed right or type in variable names correctly.
However, I'm getting the following error: Compile Error: Invalid

Qualifier,
and the .Close is highlighted.

Can someone tell me what the statement I'm looking for actually is, and if
you have the time, explain that error to me? Very much appreciated for any
help anyone can offer.

Dan





Tom Ogilvy

Trying to close a window without saving
 
in you code, highlight the object and method and hit F1.

for example, if in a code module I highlight

Range("A1").sort and hit F1 I get the help for the sort method of a range
object which includes:

expression.Sort(Key1, Order1, Key2, Type, Order2, Key3, Order3, Header,
OrderCustom, MatchCase, Orientation, SortMethod, DataOption1, DataOption2,
DataOption3)

and an explanation of each argument.

--
Regards,
Tom Ogilvy


"danhattan" wrote:

Thanks Vergel. That worked perfectly.

Another question if you've got the time. I know how to find the
methods/properties by adding the dot after the object, such as Save and
Close. But, how do I then find the parameters to go with the methods? I've
tried using the Object Explorer in VBA but it remains a bit baffling to me.

If you can answer that as well for me, that would be really cool.

In any event, thanks very much for the help you've given me.

Dan

"Vergel Adriano" wrote:

Try

ActiveWorkbook.Close False

Close.False wouldn't work because Close is a method and not an Object.
ActiveWorkbook is an object and it has properties and methods that you can
access by adding the dot. The Close method takes 3 optional parameters and
the first one is a boolean value to indicate wether or not the changes should
be saved.


"danhattan" wrote:

I have a spreadsheet that runs a macro that switches between it and a second
spreadsheet, merely moving data from the second to the first. The macro then
closes the second spreadsheet. My problem is that it prompts the user to save
before closing, and I want to remove this prompt.

I tried this line: ActiveWindow.Close.Save = False. Purely guessing, but
typed in all lower case and VBA properly capitalized it, which has always
been a sign that I've guessed right or type in variable names correctly.
However, I'm getting the following error: Compile Error: Invalid Qualifier,
and the .Close is highlighted.

Can someone tell me what the statement I'm looking for actually is, and if
you have the time, explain that error to me? Very much appreciated for any
help anyone can offer.

Dan


danhattan

Trying to close a window without saving
 
Thank you VERY much. This will be extremely helpful going forward. Great
answer.

"Tom Ogilvy" wrote:

in you code, highlight the object and method and hit F1.

for example, if in a code module I highlight

Range("A1").sort and hit F1 I get the help for the sort method of a range
object which includes:

expression.Sort(Key1, Order1, Key2, Type, Order2, Key3, Order3, Header,
OrderCustom, MatchCase, Orientation, SortMethod, DataOption1, DataOption2,
DataOption3)

and an explanation of each argument.

--
Regards,
Tom Ogilvy


"danhattan" wrote:

Thanks Vergel. That worked perfectly.

Another question if you've got the time. I know how to find the
methods/properties by adding the dot after the object, such as Save and
Close. But, how do I then find the parameters to go with the methods? I've
tried using the Object Explorer in VBA but it remains a bit baffling to me.

If you can answer that as well for me, that would be really cool.

In any event, thanks very much for the help you've given me.

Dan

"Vergel Adriano" wrote:

Try

ActiveWorkbook.Close False

Close.False wouldn't work because Close is a method and not an Object.
ActiveWorkbook is an object and it has properties and methods that you can
access by adding the dot. The Close method takes 3 optional parameters and
the first one is a boolean value to indicate wether or not the changes should
be saved.


"danhattan" wrote:

I have a spreadsheet that runs a macro that switches between it and a second
spreadsheet, merely moving data from the second to the first. The macro then
closes the second spreadsheet. My problem is that it prompts the user to save
before closing, and I want to remove this prompt.

I tried this line: ActiveWindow.Close.Save = False. Purely guessing, but
typed in all lower case and VBA properly capitalized it, which has always
been a sign that I've guessed right or type in variable names correctly.
However, I'm getting the following error: Compile Error: Invalid Qualifier,
and the .Close is highlighted.

Can someone tell me what the statement I'm looking for actually is, and if
you have the time, explain that error to me? Very much appreciated for any
help anyone can offer.

Dan


danhattan

Trying to close a window without saving
 
Thank you VERY much. This will be extremely helpful going forward. Great
answer.

"dkinn" wrote:

In addition to the help file, don't forget the simple space bar.

(In Excel03 and XP at least) after I type

Activeworkbook.close and then press the spacebar it gives me a list of the
arguments for that command.
In this case it shows me

Activeworkbook.close

close([savechanges],[filename],[routeworkbook])

to at least show me what options I have available.

Help is my best friend.


David

"Tom Ogilvy" wrote:

in you code, highlight the object and method and hit F1.

for example, if in a code module I highlight

Range("A1").sort and hit F1 I get the help for the sort method of a range
object which includes:

expression.Sort(Key1, Order1, Key2, Type, Order2, Key3, Order3, Header,
OrderCustom, MatchCase, Orientation, SortMethod, DataOption1, DataOption2,
DataOption3)

and an explanation of each argument.

--
Regards,
Tom Ogilvy


"danhattan" wrote:

Thanks Vergel. That worked perfectly.

Another question if you've got the time. I know how to find the
methods/properties by adding the dot after the object, such as Save and
Close. But, how do I then find the parameters to go with the methods? I've
tried using the Object Explorer in VBA but it remains a bit baffling to me.

If you can answer that as well for me, that would be really cool.

In any event, thanks very much for the help you've given me.

Dan

"Vergel Adriano" wrote:

Try

ActiveWorkbook.Close False

Close.False wouldn't work because Close is a method and not an Object.
ActiveWorkbook is an object and it has properties and methods that you can
access by adding the dot. The Close method takes 3 optional parameters and
the first one is a boolean value to indicate wether or not the changes should
be saved.


"danhattan" wrote:

I have a spreadsheet that runs a macro that switches between it and a second
spreadsheet, merely moving data from the second to the first. The macro then
closes the second spreadsheet. My problem is that it prompts the user to save
before closing, and I want to remove this prompt.

I tried this line: ActiveWindow.Close.Save = False. Purely guessing, but
typed in all lower case and VBA properly capitalized it, which has always
been a sign that I've guessed right or type in variable names correctly.
However, I'm getting the following error: Compile Error: Invalid Qualifier,
and the .Close is highlighted.

Can someone tell me what the statement I'm looking for actually is, and if
you have the time, explain that error to me? Very much appreciated for any
help anyone can offer.

Dan



All times are GMT +1. The time now is 10:01 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com