lizziegirl
New Member
- Joined
- Apr 3, 2006
- Messages
- 31
Hello there,
I am creating an excel workbook template, which we are going to provide to Managers as an xlt file and store in our workgroup templates. Upon accessing it, it of course becomes an xls and the Manager makes changes to it. Upon the user going file save (which is what they do out of sheer habit) I would like the file to be named specifically no matter what the user inputs to ensure consistency. The file path does not matter.
I have the below code which creates a file as I specify, however this still allows the user to save a file named however they want it and I am ending up with two files.
Can I control this at all. I have trawled previous forums howver cannot find what I am specifically after.
Any ideas..? Thanks Lizzie
I am creating an excel workbook template, which we are going to provide to Managers as an xlt file and store in our workgroup templates. Upon accessing it, it of course becomes an xls and the Manager makes changes to it. Upon the user going file save (which is what they do out of sheer habit) I would like the file to be named specifically no matter what the user inputs to ensure consistency. The file path does not matter.
I have the below code which creates a file as I specify, however this still allows the user to save a file named however they want it and I am ending up with two files.
Can I control this at all. I have trawled previous forums howver cannot find what I am specifically after.
Any ideas..? Thanks Lizzie
Code:
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
Application.DisplayAlerts = False
End Sub
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Application.DisplayAlerts = False
MyFileName = "GB Management Workbook - " & Sheets("GB").Range("e24").Text
On Error Resume Next
ActiveWorkbook.SaveAs Filename:=MyFileName & ".xls", FileFormat:= _
xlNormal, Password:="", WriteResPassword:="", ReadOnlyRecommended:=False _
, CreateBackup:=False
Application.DisplayAlerts = True
End Sub