View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Zack Barresse[_3_] Zack Barresse[_3_] is offline
external usenet poster
 
Posts: 101
Default 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?