Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 309
Default "Do you want to save changes?" question

Is there a flag or variable or property that I can check
that indicates whether or not the "Do you want to save
changes?" dialog will appear when a workbook is closed??

If someone changes the contents of a cell and tries to close
the workbook without saving, Excel knows that the user
did not save the workbook. So, just to be more clear,
how can I find out if Excel knows that a "save changes"
is required??

thank you

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,565
Default "Do you want to save changes?" question

More than one option.

Application.DisplayAlerts = False
ActiveWorkbook.Close
Application.DisplayAlerts = True

Or:

ActiveWorkbook.Close SaveChanges:=False


"Robert Crandal" wrote in message
...
Is there a flag or variable or property that I can check
that indicates whether or not the "Do you want to save
changes?" dialog will appear when a workbook is closed??

If someone changes the contents of a cell and tries to close
the workbook without saving, Excel knows that the user
did not save the workbook. So, just to be more clear,
how can I find out if Excel knows that a "save changes"
is required??

thank you



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 309
Default "Do you want to save changes?" question

I don't think that was what I was looking for..... I think
maybe I worded my original question inaccurately, so
I'll try again:

How can I know if Excel WILL display the "Save changes"
dialog box when a user tries to close the workbook???

Here is my current psuedo-code that will be run when
a closer tries to close the workbook:

If 'Excel WILL show "Save changes" box' then
MsgBox "Here comes dialog box"
else
MsgBox "You wont see "Save changes" box
end if

Does that make sense??



"JLGWhiz" wrote in message
...
More than one option.

Application.DisplayAlerts = False
ActiveWorkbook.Close
Application.DisplayAlerts = True

Or:

ActiveWorkbook.Close SaveChanges:=False


"Robert Crandal" wrote in message
...
Is there a flag or variable or property that I can check
that indicates whether or not the "Do you want to save
changes?" dialog will appear when a workbook is closed??

If someone changes the contents of a cell and tries to close
the workbook without saving, Excel knows that the user
did not save the workbook. So, just to be more clear,
how can I find out if Excel knows that a "save changes"
is required??

thank you




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,510
Default "Do you want to save changes?" question

Hi Robert,

I interpreted you question a bit differently to JLGWhiz and now not sure
that my interpretation is correct but I'll post my answer anyway. (Straight
out of Help.)

If Not ActiveWorkbook.Saved Then
MsgBox "This workbook contains unsaved changes."
End If

--
Regards,

OssieMac


"JLGWhiz" wrote:

More than one option.

Application.DisplayAlerts = False
ActiveWorkbook.Close
Application.DisplayAlerts = True

Or:

ActiveWorkbook.Close SaveChanges:=False


"Robert Crandal" wrote in message
...
Is there a flag or variable or property that I can check
that indicates whether or not the "Do you want to save
changes?" dialog will appear when a workbook is closed??

If someone changes the contents of a cell and tries to close
the workbook without saving, Excel knows that the user
did not save the workbook. So, just to be more clear,
how can I find out if Excel knows that a "save changes"
is required??

thank you



.

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,510
Default "Do you want to save changes?" question

Hi robert,

The code I posted should do that for you but perhaps it had not shown itself
before your reply so here it is again inserted in your example.

If Not ActiveWorkbook.Saved Then
MsgBox "Here comes dialog box"
Else
MsgBox "You wont see Save changes box"
End If

--
Regards,

OssieMac


"Robert Crandal" wrote:

I don't think that was what I was looking for..... I think
maybe I worded my original question inaccurately, so
I'll try again:

How can I know if Excel WILL display the "Save changes"
dialog box when a user tries to close the workbook???

Here is my current psuedo-code that will be run when
a closer tries to close the workbook:

If 'Excel WILL show "Save changes" box' then
MsgBox "Here comes dialog box"
else
MsgBox "You wont see "Save changes" box
end if

Does that make sense??



"JLGWhiz" wrote in message
...
More than one option.

Application.DisplayAlerts = False
ActiveWorkbook.Close
Application.DisplayAlerts = True

Or:

ActiveWorkbook.Close SaveChanges:=False


"Robert Crandal" wrote in message
...
Is there a flag or variable or property that I can check
that indicates whether or not the "Do you want to save
changes?" dialog will appear when a workbook is closed??

If someone changes the contents of a cell and tries to close
the workbook without saving, Excel knows that the user
did not save the workbook. So, just to be more clear,
how can I find out if Excel knows that a "save changes"
is required??

thank you




.



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 309
Default "Do you want to save changes?" question

Thank you.... that's what I was looking for! 8)

"OssieMac" wrote in message
...
Hi Robert,

I interpreted you question a bit differently to JLGWhiz and now not sure
that my interpretation is correct but I'll post my answer anyway.
(Straight
out of Help.)

If Not ActiveWorkbook.Saved Then
MsgBox "This workbook contains unsaved changes."
End If

--


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
Selecting "Save As" adds "Copy of" to file name- MS Excel 2007 ronhansen Excel Discussion (Misc queries) 1 November 15th 09 09:33 PM
"CELL("FILENAME") NOT UPDATE AFTER "SAVE AS" ACTION yossie6 Excel Discussion (Misc queries) 1 June 16th 08 12:16 PM
"Save" and "Save As" options greyed out - "Save as Webpage" option Bill Excel Discussion (Misc queries) 0 January 16th 07 04:47 PM
Validation question - allow -500%, 0%, "=50%*50%" but forbid "A", "", " ", "-" ? tskogstrom Excel Programming 2 November 27th 06 09:50 AM
save and restore "Workbook Menu Bar" & "Cell" menus Jeff Higgins Excel Programming 2 February 14th 05 01:33 AM


All times are GMT +1. The time now is 10:15 AM.

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"