View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default 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?