Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
How do I stop people from saving a workbook as a particular file name?
Maybe you could use a BeforeSave event then...
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean) Dim strFileName As Variant, strFilter As String strFilter = "Excel Files (*.xls), *.xls" If LCase(Me.Name) = "master.xls" Then Cancel = True strFileName = Application.GetSaveAsFilename("Default Name.xls", strFilter) If TypeName(strFileName) = "Boolean" Then MsgBox "You pressed cancel!", vbInformation Else If Right(LCase(strFileName), Len(strFileName) - InStrRev(strFileName, "\")) < "master.xls" Then MsgBox "You chose to save:" & vbNewLine & strFileName, vbInformation ' Application.EnableEvents = False ' Me.SaveAs strFileName ' Application.EnableEvents = True Else MsgBox "I said DO NOT save as ""Master.xls!""" End If End If End If End Sub Uncomment the three commented lines to save. Easy to test with the save lines commented out. HTH -- Regards, Zack Barresse, aka firefytr To email, remove NOSPAM "12Keys" wrote in message ups.com... Even if it was a template, how would you stop people from saving over it? If its sitting on a network drive, and 50 people need to take a copy of it. there is always 1 person thats going to get it and save over it? how do I make sure they don't? |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
How do I stop people from saving a workbook as a particular file name?
Just a thought,
Most users are offered the opportunity to disable macros which totally defeats the solution specified by the OP. It might be useful to utilize the file protection capabilities of the operating system. -- Regards, Tom Ogilvy "Zack Barresse" wrote in message ... Maybe you could use a BeforeSave event then... Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean) Dim strFileName As Variant, strFilter As String strFilter = "Excel Files (*.xls), *.xls" If LCase(Me.Name) = "master.xls" Then Cancel = True strFileName = Application.GetSaveAsFilename("Default Name.xls", strFilter) If TypeName(strFileName) = "Boolean" Then MsgBox "You pressed cancel!", vbInformation Else If Right(LCase(strFileName), Len(strFileName) - InStrRev(strFileName, "\")) < "master.xls" Then MsgBox "You chose to save:" & vbNewLine & strFileName, vbInformation ' Application.EnableEvents = False ' Me.SaveAs strFileName ' Application.EnableEvents = True Else MsgBox "I said DO NOT save as ""Master.xls!""" End If End If End If End Sub Uncomment the three commented lines to save. Easy to test with the save lines commented out. HTH -- Regards, Zack Barresse, aka firefytr To email, remove NOSPAM "12Keys" wrote in message ups.com... Even if it was a template, how would you stop people from saving over it? If its sitting on a network drive, and 50 people need to take a copy of it. there is always 1 person thats going to get it and save over it? how do I make sure they don't? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Stop People Copying a Workbook | Excel Discussion (Misc queries) | |||
How do I stop someone saving a web downloaded workbook? | Excel Discussion (Misc queries) | |||
Can i stop people from deleting my excel file | Excel Discussion (Misc queries) | |||
My hyperlinks stop working on saving the workbook | Excel Discussion (Misc queries) | |||
How do I stop Excel 2000 from saving file history from file that . | Excel Discussion (Misc queries) |