View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Simon Lloyd[_552_] Simon Lloyd[_552_] is offline
external usenet poster
 
Posts: 1
Default 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