Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 98
Default Save= False Question

Hi:

I have a macro that includes the following:

ActiveWorkbook.Close Save = False

I had anticipated that this wold result in the spreadsheet being closed but NOT being
saved. However, it appears that its being saved as its being closed.

Can someone suggest a reason, and more important, a way to prevent it being saved!

Thanks

John Baker
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 535
Default Save= False Question

Hi John,

ActiveWorkbook.Close Save = False

I had anticipated that this wold result in the spreadsheet being closed but NOT being
saved. However, it appears that its being saved as its being closed.

Can someone suggest a reason, and more important, a way to prevent it being saved!


The proper syntax is:

ActiveWorkbook.Close SaveChanges:= False

Regards,

Jan Karel Pieterse
Excel MVP
www.jkp-ads.com

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Save= False Question

John
ActiveWorkbook.Close false
works for me
or
ActiveWorkbook.Close savechanges:=false

you could also try adding
ActiveWorkbook.saved = true
before you close to clear the 'needs saving' flag

I also open stuff read only where possible
Cheers
Simon

-----Original Message-----
Hi:

I have a macro that includes the following:

ActiveWorkbook.Close Save = False

I had anticipated that this wold result in the

spreadsheet being closed but NOT being
saved. However, it appears that its being saved as its

being closed.

Can someone suggest a reason, and more important, a way

to prevent it being saved!

Thanks

John Baker
.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 98
Default Save= False Question

Jan:

The macro is as follows now and it STILL saves the spreadsheet! Any suggestions?

:
Sub InstallNo()
'
' InstallNo Macro
' Macro recorded 07/02/2004 by John H Baker
'
Msgbox ("You have elected not to install the new version of the spreadsheet. If you change
your mind you may reopen this sheet and restart the installation process later.")
ActiveWorkbook.Close SaveChanges = False
'

End Sub



Jan Karel Pieterse wrote:

Hi John,

ActiveWorkbook.Close Save = False

I had anticipated that this wold result in the spreadsheet being closed but NOT being
saved. However, it appears that its being saved as its being closed.

Can someone suggest a reason, and more important, a way to prevent it being saved!


The proper syntax is:

ActiveWorkbook.Close SaveChanges:= False

Regards,

Jan Karel Pieterse
Excel MVP
www.jkp-ads.com


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 98
Default Save= False Question


Sorry I found the mistake.

I had not put a : before the = sign!


Its unusual to require that..I have used just = in many other situations and it works just
fine.

Best

John
John Baker wrote:

Jan:

The macro is as follows now and it STILL saves the spreadsheet! Any suggestions?

:
Sub InstallNo()
'
' InstallNo Macro
' Macro recorded 07/02/2004 by John H Baker
'
Msgbox ("You have elected not to install the new version of the spreadsheet. If you change
your mind you may reopen this sheet and restart the installation process later.")
ActiveWorkbook.Close SaveChanges = False
'

End Sub



Jan Karel Pieterse wrote:

Hi John,

ActiveWorkbook.Close Save = False

I had anticipated that this wold result in the spreadsheet being closed but NOT being
saved. However, it appears that its being saved as its being closed.

Can someone suggest a reason, and more important, a way to prevent it being saved!


The proper syntax is:

ActiveWorkbook.Close SaveChanges:= False

Regards,

Jan Karel Pieterse
Excel MVP
www.jkp-ads.com




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Save= False Question

It has only worked fine by mistake

You can have named arguments or unamed arguments

if you don't have option explicit at the top of your procedure, you can put
in something like

Activeworkbook.Save SaveChanges = False

this would be seen as

Activeworkbook.Save SaveChanges:=True

to demonstrate, from the immediate window:

? Savechanges = False
True


the uninitialized variable SaveChanges is seen as False or zero in the
comparison to False (which is what you equal sign says to do in this
context).

So if you used that construct anywhere a -1 or a true is accepted, then it
would work - even though it is not used correctly.

To summarize, such usage appears to the parser that you are using unamed
arguments and you are passing an expression to be evaluated as the first
argument.

--
Regards,
Tom Ogilvy

"John Baker" wrote in message news:ni05f0tc3h
...

Sorry I found the mistake.

I had not put a : before the = sign!


Its unusual to require that..I have used just = in many other situations

and it works just
fine.

Best

John
John Baker wrote:

Jan:

The macro is as follows now and it STILL saves the spreadsheet! Any

suggestions?

:
Sub InstallNo()
'
' InstallNo Macro
' Macro recorded 07/02/2004 by John H Baker
'
Msgbox ("You have elected not to install the new version of the

spreadsheet. If you change
your mind you may reopen this sheet and restart the installation process

later.")
ActiveWorkbook.Close SaveChanges = False
'

End Sub



Jan Karel Pieterse wrote:

Hi John,

ActiveWorkbook.Close Save = False

I had anticipated that this wold result in the spreadsheet being

closed but NOT being
saved. However, it appears that its being saved as its being closed.

Can someone suggest a reason, and more important, a way to prevent it

being saved!


The proper syntax is:

ActiveWorkbook.Close SaveChanges:= False

Regards,

Jan Karel Pieterse
Excel MVP
www.jkp-ads.com



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Error and Save as question DrewWil Excel Discussion (Misc queries) 12 November 10th 08 08:05 PM
What's the best way to toggle between true and false in Excel? Hiall, My excel work involves a lot of toggling between true and false (booleantypes) ... and it's very repetitive... Is there a way to select a bunch ofcells, and press a key short-cu LunaMoon Excel Discussion (Misc queries) 9 July 29th 08 12:28 AM
Another Save Question Sandy Excel Worksheet Functions 1 May 19th 07 07:46 PM
True Or False, no matter what... it still displays the false statement rocky640[_2_] Excel Programming 2 May 13th 04 04:57 PM
A save question: Phil Hageman Excel Programming 4 July 11th 03 05:11 PM


All times are GMT +1. The time now is 05:04 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"