Stop Save as code

  • Thread starter Thread starter alex.ferrazza
  • Start date Start date
A

alex.ferrazza

Hi there guys,

is there a code to stop a user to save as if not all fields are filled
in?

thanks for your help

alex
 
Hi there guys,

is there a code to stop a user to save as if not all fields are filled
in?

thanks for your help

alex

You could use a boolean value to specify whether all the fields are
filled in.
And then only save workbook when the value is true, false to cancel.

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As
Boolean)
If Not mbAllFilled Then 'mbAllFilled is used to specify whether all
the fields are filled in.
Cancel = True
MsgBox "Please fill all of fields before you save it!"
End If
End Sub
 
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
Cancel = SaveAsUI
End Sub

The above Is the basic "to Cancel any SaveAs attempt" - maybe add as If then
statement to perform the Cancel = SaveAsUI line...

HTH,

Jim
 
The replies to your other thread include a line like:

Cancel = True

That line stops the Save.

ps. It's better to stick in the same thread when you have followup questions.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top