ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   no updates prompt at opening and save changes at closing (https://www.excelbanter.com/excel-discussion-misc-queries/125272-no-updates-prompt-opening-save-changes-closing.html)

Shariq

no updates prompt at opening and save changes at closing
 
I couldn't find anything in this regard on help menu, but if it is possible
in excel, I'd like to know if I can make a book which when closing shouldn't
ask for save changes or is it really not possible, I'd appreciate any replies
in this regard.

SHARIQ

thanks in advance

Alan

no updates prompt at opening and save changes at closing
 
Only with VBA,
Hit Ctrl an F11 to open the VB editor, double click 'This Workbook' and copy
and paste this code into it,

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As
Boolean)
ThisWorkbook.Saved = True
End Sub

Bear in mind that if someone opens the workbook with macro's disabled they
can do as they wish. There are ways to overcome that too, but Excel
protection of all kinds is weak and can be easily circumvented.
Regards,
Alan.

"Shariq" wrote in message
...
I couldn't find anything in this regard on help menu, but if it is possible
in excel, I'd like to know if I can make a book which when closing
shouldn't
ask for save changes or is it really not possible, I'd appreciate any
replies
in this regard.

SHARIQ

thanks in advance




Gord Dibben

no updates prompt at opening and save changes at closing
 
Do you want the workbook to close and save or just close without saving?

This code will save the workbook with changes and no prompt.

Private Sub Workbook_BeforeClose(Cancel As Boolean)
ActiveWorkbook.Save
End Sub

This wiill close with no save and no prompt.

Private Sub Workbook_BeforeClose(Cancel As Boolean)
ThisWorkbook.Saved = True
End Sub


Gord Dibben MS Excel MVP

On Mon, 8 Jan 2007 16:30:01 -0800, Shariq
wrote:

I couldn't find anything in this regard on help menu, but if it is possible
in excel, I'd like to know if I can make a book which when closing shouldn't
ask for save changes or is it really not possible, I'd appreciate any replies
in this regard.

SHARIQ

thanks in advance



Shariq

no updates prompt at opening and save changes at closing
 
Hi Alan!

Well, first of all I'd like to thank you, that you replied to my question,
but some how the result I was looking for hasen't been achieved, or may be my
question wasen't clear enough, so if you care to answer to my question once
again please,

the question is.
When I close only this certain workbook it should'nt ask for save changes
but just closes its not important if changes made in the book are saved or
not (like for instance automatically) or so, so what you told about VBA
system, SO may be I didn't understand what it is, because I pressed CTRL +
F11 by doing so a new sheet got added to the book a macro 1 I copied and
pasted what you had suggested but it didn't work, so please can yu educate
me on this as how to do it properly,

thanx
Shariq

"Alan" wrote:

Only with VBA,
Hit Ctrl an F11 to open the VB editor, double click 'This Workbook' and copy
and paste this code into it,

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As
Boolean)
ThisWorkbook.Saved = True
End Sub

Bear in mind that if someone opens the workbook with macro's disabled they
can do as they wish. There are ways to overcome that too, but Excel
protection of all kinds is weak and can be easily circumvented.
Regards,
Alan.

"Shariq" wrote in message
...
I couldn't find anything in this regard on help menu, but if it is possible
in excel, I'd like to know if I can make a book which when closing
shouldn't
ask for save changes or is it really not possible, I'd appreciate any
replies
in this regard.

SHARIQ

thanks in advance






All times are GMT +1. The time now is 03:28 PM.

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