Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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
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


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I stop Excel 2007 from creating backup copies? KLB[_2_] Excel Discussion (Misc queries) 3 April 4th 23 10:26 AM
Shared Workbook creating Backup when saved? LG Excel Discussion (Misc queries) 1 July 21st 08 10:58 PM
Creating Automatic Backup Files on another drive helvetik New Users to Excel 3 February 23rd 07 09:04 PM
stop my speadsheet from creating an automatic backup copy lggallo Excel Discussion (Misc queries) 3 May 18th 05 10:01 PM
Creating excel backup files Andrew Fekete Excel Programming 1 October 14th 03 11:35 PM


All times are GMT +1. The time now is 04:26 PM.

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"