Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
closing a file without saving
Hi
i wish to write a macro that stops the message "do you want to save changes" appearing when i close a file after using it is there a simple way either in excel of VB Editor to disable/prevent this message from appearing automatically? i am needing this because i am sharing files with colleagues in my maths dept but want them to use the files without accidentally altering them or saving their changes or even being asked this question when they exit the file or excel i have tried stuff with Before close but to no success preventing this dialogue box from appearing when the apllication excel is closed or when the file itself is closed would be very useful Regards Matt - a techer of maths in manchester, england |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
closing a file without saving
Matt,
Just set the Cancel argument in Before_close to true. Private Sub Workbook_BeforeClose(Cancel As Boolean) Cancel = True End Sub and make sure that you put it in the ThisWorkbook code module. By the way, what is a techer? -- HTH Bob Phillips ... looking out across Poole Harbour to the Purbecks (remove nothere from the email address if mailing direct) "matt dunbar" wrote in message ... Hi i wish to write a macro that stops the message "do you want to save changes" appearing when i close a file after using it is there a simple way either in excel of VB Editor to disable/prevent this message from appearing automatically? i am needing this because i am sharing files with colleagues in my maths dept but want them to use the files without accidentally altering them or saving their changes or even being asked this question when they exit the file or excel i have tried stuff with Before close but to no success preventing this dialogue box from appearing when the apllication excel is closed or when the file itself is closed would be very useful Regards Matt - a techer of maths in manchester, england |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
closing a file without saving
Hi Bob:
Did you mean the following?: Private Sub Workbook_BeforeClose(Cancel As Boolean) Saved = True End Sub Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean) Cancel = True End Sub Regards, Vasant. "Bob Phillips" wrote in message ... Matt, Just set the Cancel argument in Before_close to true. Private Sub Workbook_BeforeClose(Cancel As Boolean) Cancel = True End Sub and make sure that you put it in the ThisWorkbook code module. By the way, what is a techer? -- HTH Bob Phillips ... looking out across Poole Harbour to the Purbecks (remove nothere from the email address if mailing direct) "matt dunbar" wrote in message ... Hi i wish to write a macro that stops the message "do you want to save changes" appearing when i close a file after using it is there a simple way either in excel of VB Editor to disable/prevent this message from appearing automatically? i am needing this because i am sharing files with colleagues in my maths dept but want them to use the files without accidentally altering them or saving their changes or even being asked this question when they exit the file or excel i have tried stuff with Before close but to no success preventing this dialogue box from appearing when the apllication excel is closed or when the file itself is closed would be very useful Regards Matt - a techer of maths in manchester, england |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
closing a file without saving
I think so <vbg.
-- HTH Bob Phillips ... looking out across Poole Harbour to the Purbecks (remove nothere from the email address if mailing direct) "Vasant Nanavati" <vasantn *AT* aol *DOT* com wrote in message ... Hi Bob: Did you mean the following?: Private Sub Workbook_BeforeClose(Cancel As Boolean) Saved = True End Sub Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean) Cancel = True End Sub Regards, Vasant. "Bob Phillips" wrote in message ... Matt, Just set the Cancel argument in Before_close to true. Private Sub Workbook_BeforeClose(Cancel As Boolean) Cancel = True End Sub and make sure that you put it in the ThisWorkbook code module. By the way, what is a techer? -- HTH Bob Phillips ... looking out across Poole Harbour to the Purbecks (remove nothere from the email address if mailing direct) "matt dunbar" wrote in message ... Hi i wish to write a macro that stops the message "do you want to save changes" appearing when i close a file after using it is there a simple way either in excel of VB Editor to disable/prevent this message from appearing automatically? i am needing this because i am sharing files with colleagues in my maths dept but want them to use the files without accidentally altering them or saving their changes or even being asked this question when they exit the file or excel i have tried stuff with Before close but to no success preventing this dialogue box from appearing when the apllication excel is closed or when the file itself is closed would be very useful Regards Matt - a techer of maths in manchester, england |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Saving and closing | Setting up and Configuration of Excel | |||
Saving and Closing | Excel Worksheet Functions | |||
Saving and Closing | Excel Discussion (Misc queries) | |||
auto saving & closing file | Excel Worksheet Functions | |||
How to code on Macro on saving and closing a file? | Excel Worksheet Functions |