winglessbuzzard
New Member
- Joined
- Jan 12, 2009
- Messages
- 29
I have a large group of files and people using the files seem fond of renaming the files and changing the extension (.xlsm --> .xlsb..). I want to keep this from happening.
The users should be able to move the files wherever they want (other directories..etc), but not change the file name while in excel (I know they could still right-click the file and rename it from the file explorer... I'll leave that issue alone for now.)
my bad attempt at this:
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
Dim mywb As String
mywb = ThisWorkbook.Name
ThisWorkbook.SaveAs mywb
End Sub
... the above code doesn't quite get to what I'm trying... it saves the file as soon as the saveas dialog box opens, lets you rename the file and save it again anywhere with any new name/extension.
Just to be clear, all I'm trying to do is force the user to keep the original file name and extension while also allowing them to save the file in a different directory.
The users should be able to move the files wherever they want (other directories..etc), but not change the file name while in excel (I know they could still right-click the file and rename it from the file explorer... I'll leave that issue alone for now.)
my bad attempt at this:
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
Dim mywb As String
mywb = ThisWorkbook.Name
ThisWorkbook.SaveAs mywb
End Sub
... the above code doesn't quite get to what I'm trying... it saves the file as soon as the saveas dialog box opens, lets you rename the file and save it again anywhere with any new name/extension.
Just to be clear, all I'm trying to do is force the user to keep the original file name and extension while also allowing them to save the file in a different directory.