Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,355
Default Workbook BeforeSave

Is there some way to prevent saving under certain conditions int he
workbook_before save method?
Thanks,

Barb Reinhardt

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Workbook BeforeSave

Barb,

Put the tests in the BeforeSave event in ThisWorkbook and if the tests
indicate that the Save should be prevented, set the Cancel parameter
that is passed into BeforeSave to True.

Cordially,
Chip Pearson
Microsoft MVP 1998 - 2010
Pearson Software Consulting, LLC
www.cpearson.com
[email on web site]



On Wed, 20 Jan 2010 11:52:02 -0800, Barb Reinhardt
wrote:

Is there some way to prevent saving under certain conditions int he
workbook_before save method?
Thanks,

Barb Reinhardt

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,069
Default Workbook BeforeSave

What are the conditions? Can you test for them with and IF statement? or put
an if statement in a cell value and test if that cell has a value in the code?

"Barb Reinhardt" wrote:

Is there some way to prevent saving under certain conditions int he
workbook_before save method?
Thanks,

Barb Reinhardt

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 489
Default Workbook BeforeSave

Yeah that is possible. But I'm not sure what conditions you are wanting to
test so I assumed one. Put this in the before save event. Hope this helps!
If so, let me know, click "YES" below.

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)

If Sheets("Sheet1").Range("A1").Value = "Don't Save" Then
Cancel = True
End If

End Sub
--
Cheers,
Ryan


"Barb Reinhardt" wrote:

Is there some way to prevent saving under certain conditions int he
workbook_before save method?
Thanks,

Barb Reinhardt

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,355
Default Workbook BeforeSave

I figured it out. I forgot to include CANCEL = TRUE when I didn't want to
save.

Thanks,

Barb Reinhardt



"John" wrote:

What are the conditions? Can you test for them with and IF statement? or put
an if statement in a cell value and test if that cell has a value in the code?

"Barb Reinhardt" wrote:

Is there some way to prevent saving under certain conditions int he
workbook_before save method?
Thanks,

Barb Reinhardt

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
workbook beforesave event JMCS Excel Programming 4 October 16th 09 10:26 AM
Use Workbook BeforeSave Event to Save Copy to Different Location RyanH Excel Programming 9 October 23rd 08 07:48 PM
Protect Worksheet / Workbook in BeforeSave Event tc69 Excel Programming 2 April 23rd 07 11:00 AM
BeforeSave sub won't save another workbook when triggered by another event sub Brad Yundt Excel Programming 1 June 3rd 04 03:12 AM
BeforeSave workbook event Cindy Excel Programming 15 February 10th 04 04:28 PM


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