"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

0
Robert
12/6/2009 3:09:06 AM
excel.programming 6508 articles. 2 followers. Follow

5 Replies
985 Views

Similar Articles

[PageSpeed] 12

More than one option.

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

Or:

ActiveWorkbook.Close SaveChanges:=False


"Robert Crandal" <nobody@gmail.com> wrote in message 
news:lfFSm.60560$%j4.27038@newsfe18.iad...
> 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
> 


0
JLGWhiz
12/6/2009 3:28:08 AM
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" <JLGWhiz@cfl.rr.com> wrote in message 
news:Ok$vxRidKHA.5472@TK2MSFTNGP02.phx.gbl...
> More than one option.
>
> Application.DisplayAlerts = False
> ActiveWorkbook.Close
> Application.DisplayAlerts = True
>
> Or:
>
> ActiveWorkbook.Close SaveChanges:=False
>
>
> "Robert Crandal" <nobody@gmail.com> wrote in message 
> news:lfFSm.60560$%j4.27038@newsfe18.iad...
>> 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
>>
>
> 

0
Robert
12/6/2009 4:09:44 AM
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" <nobody@gmail.com> wrote in message 
> news:lfFSm.60560$%j4.27038@newsfe18.iad...
> > 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
> > 
> 
> 
> .
> 
0
Utf
12/6/2009 4:16:01 AM
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" <JLGWhiz@cfl.rr.com> wrote in message 
> news:Ok$vxRidKHA.5472@TK2MSFTNGP02.phx.gbl...
> > More than one option.
> >
> > Application.DisplayAlerts = False
> > ActiveWorkbook.Close
> > Application.DisplayAlerts = True
> >
> > Or:
> >
> > ActiveWorkbook.Close SaveChanges:=False
> >
> >
> > "Robert Crandal" <nobody@gmail.com> wrote in message 
> > news:lfFSm.60560$%j4.27038@newsfe18.iad...
> >> 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
> >>
> >
> > 
> 
> .
> 
0
Utf
12/6/2009 5:49:01 AM
Thank you.... that's what I was looking for!   8)

"OssieMac" <OssieMac@discussions.microsoft.com> wrote in message 
news:4242BD55-4C15-4FFC-8FD7-A4C98F624F59@microsoft.com...
> 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
>
> -- 

0
Robert
12/6/2009 8:32:54 AM
Reply:

Similar Artilces:

Do you want to save changes?
Everytime a shared workbook is opened and then closed without changes being made to it, users are prompted by the following: This document has been modified. Do you want to save changes? Yes: Saves your changes. No: Discards your changes. Cancel Keeps this document open. Using excel 2002. Again, no changes are made and the prompt still comes up. Thanks in advance for any help. NWH Hi not sure but could be a 'feature' of shared workbooks. another reason could be the use of volatile functions: http://www.decisionmodels.com/calcsecretsi.htm -- Regards Frank Kabel...

"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 More than one option. Application.DisplayAlerts = False ActiveWorkbook.Close Application.DisplayAlerts = True Or: ActiveWorkbook.Clos...

"Do you want to save changes?" after editing email
I'm using Windows and Office XP Pro, and in Outlook I am composing messages in Rich Text format, and have selected the "use Microsoft Word to edit e-mail messages" and "use MS Word to read Rich Text messages" options. When I make any changes to an e-mail that has been sent to me, upon closing the e-mail, a pop up window appears asking me if I want to save changes (just like when you make any changes to a Word document). Annoying! I'd like to get rid of this feature. Thank you, Trish Regardless of whether or not Word is set as you editor or what message fo...