Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Can you fix this?? vbreadonly
Hi all,
I have this code fo creating a monthly back up which works fine, bu trying to make the back up Read Only is causing a problem! This code gives me a problem at the line Set Attr sStr ,VB ReadOnly does anyone know a fix for this? 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 Dim sStr As String Dim sName As ThisWorkbook 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 sStr SetAttr sStr, vbReadOnly .Save End With End Su -- Message posted from http://www.ExcelForum.com |