G
Guest
I have made a travel expense file template.
In the sub workbook_open() it creates a copy of the template with new
filename which add the day + month + year + hour+min+sec to make it
impossible to have two files with same name. However, I want people to be
able to open the new file without making another copy. People should be able
to edit the file without starting the macro below. How can I "delete" the
macro or disable the macro on the file copy?
I know the procedure of holding down shift key when opening, but is there
another way so people can open the file as they open every file?
Private Sub Workbook_Open()
Dim fNr As String
Dim Hr As Long
Dim Min As Long
Dim Sec As Long
Dim Dag As Long
Dim Mnd As Long
Dim Aar As Long
Dag = Day(Now())
Mnd = Month(Now())
Aar = Year(Now())
Hr = Hour(Now())
Min = Minute(Now())
Sec = Second(Now())
fNr = Trim(Str(Dag)) + Trim(Str(Mnd)) + Trim(Str(Aar)) + Trim(Str(Hr)) +
Trim(Str(Min)) + Trim(Str(Sec))
ChDir "o:\Travel"
ActiveWorkbook.SaveAs Filename:= _
"o:\Travel\Copy\Travel_" + fNr + ".xls", FileFormat:= _
xlNormal, Password:="", WriteResPassword:="",
ReadOnlyRecommended:=False _
, CreateBackup:=False
MsgBox ("You are now working on a copy of the travel expenses template.")
End Sub
In the sub workbook_open() it creates a copy of the template with new
filename which add the day + month + year + hour+min+sec to make it
impossible to have two files with same name. However, I want people to be
able to open the new file without making another copy. People should be able
to edit the file without starting the macro below. How can I "delete" the
macro or disable the macro on the file copy?
I know the procedure of holding down shift key when opening, but is there
another way so people can open the file as they open every file?
Private Sub Workbook_Open()
Dim fNr As String
Dim Hr As Long
Dim Min As Long
Dim Sec As Long
Dim Dag As Long
Dim Mnd As Long
Dim Aar As Long
Dag = Day(Now())
Mnd = Month(Now())
Aar = Year(Now())
Hr = Hour(Now())
Min = Minute(Now())
Sec = Second(Now())
fNr = Trim(Str(Dag)) + Trim(Str(Mnd)) + Trim(Str(Aar)) + Trim(Str(Hr)) +
Trim(Str(Min)) + Trim(Str(Sec))
ChDir "o:\Travel"
ActiveWorkbook.SaveAs Filename:= _
"o:\Travel\Copy\Travel_" + fNr + ".xls", FileFormat:= _
xlNormal, Password:="", WriteResPassword:="",
ReadOnlyRecommended:=False _
, CreateBackup:=False
MsgBox ("You are now working on a copy of the travel expenses template.")
End Sub