Allow save as but not save

Declamatory

Active Member
Joined
Nov 6, 2014
Messages
319
I have a workbook that I want people to be able to access and run a macro that changes the data in the workbook and then does a save as. I don't want people to be able to save over the original workbook. Does anyone know how to do this?
 

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.
Make the workbook Read Only.
 
Upvote 0
you would have to use something like this:

VBA Code:
Option Explicit

Sub SaveFile()

Dim fdate As Date
Dim fname As String
Dim path As String

fdate = Range("A1").Value
path = Application.ActiveWorkbook.path

If fdate > 0 Then
    fname = "Event " & fdate
    Application.ActiveWorkbook.SaveAs Filename:=path & "\" & fname, _
        FileFormat:=xlOpenXMLWorkbookMacroEnabled, CreateBackup:=False
Else
    MsgBox "Chose a date for the event", vbOKOnly
End If

End Sub

This needsto beadjusted to your needs, but without more details its hard to do it.
 
Upvote 0
you would have to use something like this:

VBA Code:
Option Explicit

Sub SaveFile()

Dim fdate As Date
Dim fname As String
Dim path As String

fdate = Range("A1").Value
path = Application.ActiveWorkbook.path

If fdate > 0 Then
    fname = "Event " & fdate
    Application.ActiveWorkbook.SaveAs Filename:=path & "\" & fname, _
        FileFormat:=xlOpenXMLWorkbookMacroEnabled, CreateBackup:=False
Else
    MsgBox "Chose a date for the event", vbOKOnly
End If

End Sub

This needsto beadjusted to your needs, but without more details its hard to do it.
That code will do a "SaveAs", but does not prevent the user from doing their own "Save" saving over the original file, which is a vital requirement of the question.
 
Upvote 0
Also, sorry to do an add on but I will need to occasionally edit the workbook e.g. public holidays or new products so I need to be able to go in and save.
 
Upvote 0
Also, sorry to do an add on but I will need to occasionally edit the workbook e.g. public holidays or new products so I need to be able to go in and save.
Did you look at the link I provided?
You will be able to open, edit, and save it, provided you know the password you set on it to make it read-only.
So only those who you want to have the authority to make changes to and save over the file should know the password.
 
Upvote 0

Forum statistics

Threads
1,215,256
Messages
6,123,914
Members
449,132
Latest member
Rosie14

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