LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 21
Default Don't save file if condition is met

Hello,

I have tried this macro to disable the save function if the cell A1 contains
the value 1 when the user wants to save the file
I want the file to close without asking if the user any questions, but there
seems to be a coding error.
Can anyone help please?
PS I imagine I should also use the same code for the event "Private Sub
Workbook_BeforeClose"?

Thank you in advance

André

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

If Worksheets("Start").Cells(1, 1) = 1 Then

MsgBox "You have already Eliminated Rows! THIS FILE WILL NOT SAVE!"

ActiveWorkbook.Close = False

End If

End Sub





In ELIMINATE ROWS MACRO:



Worksheets("Master").Cells(1,1).Value = 1


 
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
Save Condition GarToms Excel Worksheet Functions 0 May 2nd 06 03:33 PM
Save If Condition is true igorek Excel Programming 2 July 12th 05 11:19 PM
Code to Test Condition and Save Record to Excel Ken Hudson Excel Programming 0 May 25th 05 05:32 PM
Excel marcos firing on file save as but not file save Andy Excel Programming 1 August 3rd 04 10:34 AM
Save File to Another Directory, but not change Users File Save location Mike Knight Excel Programming 1 May 28th 04 09:06 PM


All times are GMT +1. The time now is 02:46 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"