Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1
Default How do I run a macro upon saving a file but prior to actual save?

Excel 2003 - The user does not want the file to be allowed to save if the
value in a given field does not equal zero. Is there a way to run a macro
when a save is executed?
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,942
Default How do I run a macro upon saving a file but prior to actual save?

hi
yes there is a before save event. it is thisworkbook code so paste your
macro in the thisworkbook-beforesave

Regards
FSt1


"Hawk186" wrote:

Excel 2003 - The user does not want the file to be allowed to save if the
value in a given field does not equal zero. Is there a way to run a macro
when a save is executed?

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 22,906
Default How do I run a macro upon saving a file but prior to actual save?

Private Sub Workbook_BeforeSave(ByVal SaveAsUI _
As Boolean, Cancel As Boolean)
If Sheets("Sheet1").Range("A1") < 0 Then
Cancel = True
MsgBox "Sheet1 A1 is not zero, save has been cancelled"
End If
End Sub


Gord Dibben MS Excel MVP

On Fri, 6 Jun 2008 11:01:01 -0700, Hawk186
wrote:

Excel 2003 - The user does not want the file to be allowed to save if the
value in a given field does not equal zero. Is there a way to run a macro
when a save is executed?


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
How do I print sheet , with actual file save date in footer? irfy Excel Worksheet Functions 6 June 26th 08 12:01 AM
accidental save - recover prior version of Excel file? Gailbee Excel Discussion (Misc queries) 2 November 14th 07 03:24 PM
Save as prompt missing saving a .csv file bdw Excel Discussion (Misc queries) 1 May 9th 06 10:10 PM
formula for month(s) prior to actual braadi Excel Worksheet Functions 4 December 7th 05 05:00 PM
formula for month that is prior to actual braadi Excel Worksheet Functions 4 December 6th 05 07:32 PM


All times are GMT +1. The time now is 01:35 PM.

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"