![]() |
is it possible to disable the ability to save a file unless the u.
I'm trying to stop users from saving a file unless they have entered an
explanatory note in a specified cell (or perhaps range). Is this possible and, if so, how? Instructions for a warning message would also be useful. |
is it possible to disable the ability to save a file unless the u.
Something like this should do it for you. Change the sheet name and cell
reference as needed. It will look at the specified cell and if nothing is in it, it will present the message and cancel the save operation. If something is in the cell, it just saves as usual. Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean) If IsEmpty(Worksheets("Sheet1").Range("F9")) Then MsgBox "You must make an entry on Sheet1, in Cell F9 before saving.", _ vbOKOnly, "Save Cancelled" Cancel = True Exit Sub End If End Sub This page will help you in getting the code into the right place in the workbook: http://www.jlathamsite.com/Teach/WorkbookCode.htm "AucklandAssault" wrote: I'm trying to stop users from saving a file unless they have entered an explanatory note in a specified cell (or perhaps range). Is this possible and, if so, how? Instructions for a warning message would also be useful. |
is it possible to disable the ability to save a file unless the u.
Anything you could do would be defeated if users disabled macros when opening
the workbook but yes you can prevent saving if users enable macros. Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean) If Sheet1.Range("A1").Value = "" Then Cancel = True MsgBox "Please complete cell A1" End If End Sub Copy Jim Rech's code above into the Thisworkbook module. To open that module right-click on the Excel Icon left of "File" on the menu. Select "View Code" Paste into that module. Gord Dibben MS Excel MVP On Wed, 8 Nov 2006 09:59:01 -0800, AucklandAssault wrote: I'm trying to stop users from saving a file unless they have entered an explanatory note in a specified cell (or perhaps range). Is this possible and, if so, how? Instructions for a warning message would also be useful. |
All times are GMT +1. The time now is 11:45 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com