#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 846
Default Autosave

I'm trying to write a macro that when a master file is saved, it will
automatically save a read only copy in another folder, any suggestions?

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Autosave

You could use a macro that saves a copy in your favorite backup folder and then
marks the file readonly (the windows attribute).

Option Explicit
Sub testme01()
Dim myPath As String
Dim myFileName As String

myPath = "C:\backups"
If Right(myPath, 1) < "\" Then
myPath = myPath & "\"
End If

With ThisWorkbook
'save the workbook
.Save

myFileName = myPath & .Name

On Error Resume Next 'in case it's not there
'vbNormal will allow the code to overwrite the file
SetAttr pathname:=myFileName, attributes:=vbNormal
On Error GoTo 0

.SaveCopyAs Filename:=myFileName
SetAttr pathname:=myFileName, attributes:=vbReadOnly

End With

End Sub

Brad wrote:

I'm trying to write a macro that when a master file is saved, it will
automatically save a read only copy in another folder, any suggestions?


--

Dave Peterson
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
Opened Autosave but when closing workbook Autosave closes itself Ken Excel Worksheet Functions 0 October 29th 05 05:11 PM
autosave kellydpv Excel Programming 1 June 29th 05 11:52 AM
Autosave Liz[_4_] Excel Programming 1 July 29th 04 08:37 PM
Removing AUTOSAVE.XLS(AUTOSAVE.XLA) from VBA editor??? belblanco[_13_] Excel Programming 5 July 17th 04 10:24 AM
Removing AUTOSAVE.XLS(AUTOSAVE.XLA) from VBA editor??? belblanco[_14_] Excel Programming 0 July 13th 04 07:23 PM


All times are GMT +1. The time now is 09:28 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"