Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Creating a read only backup??
Hi all,
I have this code in the this workbook module which works fine but would like to make one tweak to it.....i would like the back up copy t be read only, can anyone help with the line i should insert to do this? Simon Here's the code!.... Private Sub Workbook_BeforeClose(Cancel As Boolean) Dim lDat_Today As Date Dim lDat_Tomorrow As Date Dim lStr_TargetFile As String lDat_Today = Date If "Fri" = Format(Date, "ddd") Then lDat_Tomorrow = Date + 3 Else lDat_Tomorrow = Date + 1 End If With ThisWorkbook If Month(lDat_Today) = Month(lDat_Tomorrow) Then Else .SaveCopyAs ThisWorkbook.Path & "\" & _ Left(ThisWorkbook.Name, InStr(1, LCase(ThisWorkbook.Name), ".xls") - 1) & _ " - " & Format(Now, "yyyymmdd") & ".xls" End If .Save End With End Su -- Message posted from http://www.ExcelForum.com |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Creating a read only backup??
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Dim lDat_Today As Date Dim lDat_Tomorrow As Date Dim lStr_TargetFile As String Dim sStr as String lDat_Today = Date If "Fri" = Format(Date, "ddd") Then lDat_Tomorrow = Date + 3 Else lDat_Tomorrow = Date + 1 End If With ThisWorkbook If Month(lDat_Today) = Month(lDat_Tomorrow) Then Else sStr = ThisWorkbook.Path & "\" & _ Left(ThisWorkbook.Name, InStr(1, _ LCase(ThisWorkbook.Name), _ ".xls") - 1) & _ " - " & Format(Now, "yyyymmdd") & ".xls" End If .SaveCopyAs sName setattr sName, vbReadOnly .Save End With End Sub -- Regards, Tom Ogilvy "Simon Lloyd " wrote in message ... Hi all, I have this code in the this workbook module which works fine but i would like to make one tweak to it.....i would like the back up copy to be read only, can anyone help with the line i should insert to do this? Simon Here's the code!.... Private Sub Workbook_BeforeClose(Cancel As Boolean) Dim lDat_Today As Date Dim lDat_Tomorrow As Date Dim lStr_TargetFile As String lDat_Today = Date If "Fri" = Format(Date, "ddd") Then lDat_Tomorrow = Date + 3 Else lDat_Tomorrow = Date + 1 End If With ThisWorkbook If Month(lDat_Today) = Month(lDat_Tomorrow) Then Else SaveCopyAs ThisWorkbook.Path & "\" & _ Left(ThisWorkbook.Name, InStr(1, LCase(ThisWorkbook.Name), ".xls") - 1) & _ " - " & Format(Now, "yyyymmdd") & ".xls" End If Save End With End Sub --- Message posted from http://www.ExcelForum.com/ |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How do I stop Excel 2007 from creating backup copies? | Excel Discussion (Misc queries) | |||
Shared Workbook creating Backup when saved? | Excel Discussion (Misc queries) | |||
Creating Automatic Backup Files on another drive | New Users to Excel | |||
stop my speadsheet from creating an automatic backup copy | Excel Discussion (Misc queries) | |||
Creating excel backup files | Excel Programming |