Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,080
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default 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
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
Saving and closing erf Setting up and Configuration of Excel 4 June 18th 08 06:52 PM
Saving and Closing erf Excel Worksheet Functions 3 June 18th 08 05:03 PM
Saving and Closing erf Excel Discussion (Misc queries) 1 June 18th 08 08:38 AM
auto saving & closing file prtcorvette Excel Worksheet Functions 1 May 21st 08 10:06 PM
How to code on Macro on saving and closing a file? Eric Excel Worksheet Functions 1 June 10th 07 01:32 PM


All times are GMT +1. The time now is 07:41 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"