Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 138
Default how do I block users to save the excel file if conditions not met

I created a excel template for the users to complete. However, I noticed
that the users ignore the important cells and send the files out for
processing.

I suppose the users save the file as well.

Therefore, I would like to check if it is possibile to block the files being
saved or send if the conditions are not met. Example, Name cells must be
filled or Total must not be less then zero.

Thanks in advance.
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 8,520
Default how do I block users to save the excel file if conditions not met

From workbook press Alt+F11 to launch VBE (Visual Basic Editor). From the
left treeview search for the workbook name and click on + to expand it.
Within that you should see the following

VBAProject(Your_Filename)
Microsoft Excel Objects
Sheet1(Sheet1)
Sheet2(Sheet2)
Sheet3(Sheet3)
This Workbook

Double click 'This WorkBook' and paste the below code to the right code pane
...The below code will check for the fields Sheet1A1 is blank and also check
whether Sheet2B1 is 0..Modify to suit your requirement

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
If Trim(Worksheets("Sheet1").Range("A1")) = "" Then Cancel = True
If Worksheets("Sheet2").Range("B1").Value = 0 Then Cancel = True

If Cancel = True Then _
MsgBox "Cannot save. Mandatory fields are blank"
End Sub

If this post helps click Yes
---------------
Jacob Skaria


"Jonathan" wrote:

I created a excel template for the users to complete. However, I noticed
that the users ignore the important cells and send the files out for
processing.

I suppose the users save the file as well.

Therefore, I would like to check if it is possibile to block the files being
saved or send if the conditions are not met. Example, Name cells must be
filled or Total must not be less then zero.

Thanks in advance.

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 AUTO NAME A SAVED FILE FROM A SPEC. BLOCK IN EXCEL? bbrinker Excel Discussion (Misc queries) 8 December 16th 08 11:01 PM
Setting all users to save Excel 2007 files in 2003 format Owen K Excel Discussion (Misc queries) 0 August 16th 08 01:31 AM
Block a file in Excel from being emailed through Outlook Liz Excel Discussion (Misc queries) 2 May 15th 07 04:54 PM
Save in Excel several users server Jan Excel Discussion (Misc queries) 0 February 14th 06 05:25 PM
Help - Automating a file.. Adding Users , Deleting users, Changing Tim Harding Excel Worksheet Functions 0 March 16th 05 01:25 PM


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