Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
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?



  #2   Report Post  
Posted to microsoft.public.excel.programming
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?





Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Stop People Copying a Workbook Deborah Excel Discussion (Misc queries) 8 May 5th 10 03:09 PM
How do I stop someone saving a web downloaded workbook? Jojo999 Excel Discussion (Misc queries) 2 May 26th 09 02:01 PM
Can i stop people from deleting my excel file Sheriff Excel Discussion (Misc queries) 3 July 3rd 08 12:25 AM
My hyperlinks stop working on saving the workbook RobDLondon Excel Discussion (Misc queries) 2 September 11th 06 02:46 PM
How do I stop Excel 2000 from saving file history from file that . Cathy Excel Discussion (Misc queries) 0 March 29th 05 03:27 PM


All times are GMT +1. The time now is 05:11 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"