LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 08:02 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"