Deny Users to save over existing form, but enable Save As option

I heart Excel

Board Regular
Joined
Feb 28, 2011
Messages
66
I have created a form within Excel 2007 for our end users to fill out and submit through a approval trail. I have set up everything to go, the only thing I am really struggling with are the saving options.

I want an end user to be able to access the form, fill out the appropriate fields and submit the form. I then want them to, if required, to save the form in a personal location.

Therefore I need to stop 'Save' but allow 'Save As'. I have read a number of forums and tried different things, but once saved the end users can still override the form.

Any ideas?!
 

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.
Try this in the ThisWorkbook module

Code:
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
If Not SaveAsUI Then
    Cancel = True
    MsgBox "You must use Save As", vbExclamation
End If
End Sub
 
Upvote 0
A simple question. If you allow Save as, what is to stop them from drilling down to wherever the workbook was originally opened and saving it with the same name ?
 
Upvote 0
I did the following -

Private Sub DTPicker1_CallbackKeyDown(ByVal KeyCode As Integer, ByVal Shift As Integer, ByVal CallbackField As String, CallbackDate As Date)
End Sub

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
If Not SaveAsUI Then
Cancel = True
MsgBox "You must use Save As", vbExclamation
End If
End Sub


The top one is already on the form.

It hasn't worked as one of my colleagues has bee nable to fill out the fields and save over the existing document.

Could I be doing something wrong?

*Also with the Save As over the original document they wouldn't do this, as they would need to save it in a personal location and it is currently in my drive, which they wouldn't want to keep the form in.
 
Upvote 0
I am guessing that you want to be able to change the wb easily in place (where its stored), but not allow users to easily botch it up...

Not tested, but maybe try slowing them down a bit by marking it read-only if in the original folder and you're not the user.
Rich (BB code):
Private Sub Workbook_Open()
    
    If Environ("username") = "YourUsername" Then
        If ThisWorkbook.ReadOnly Then
            ThisWorkbook.ChangeFileAccess xlReadWrite, "Your Password"
        End If
    Else
        If Not ThisWorkbook.ReadOnly And ThisWorkbook.FullName = "C:\Data\MyWBName.xls" Then
            ThisWorkbook.ChangeFileAccess xlReadOnly, "Your Password"
    End If
    
End Sub
Hope that helps,

Mark
 
Upvote 0
The code I posted must go in the ThisWorkbook module. Press ALT + F11 to open the Visual Basic Editor. In the Project window double click ThisWorkbook then paste in the code.
 
Upvote 0

Forum statistics

Threads
1,224,595
Messages
6,179,798
Members
452,943
Latest member
Newbie4296

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top