ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Save Archive Copy as Read Only (https://www.excelbanter.com/excel-programming/431620-save-archive-copy-read-only.html)

Anders

Save Archive Copy as Read Only
 
Hi - using RDB6 http://www.rondebruin.nl/copy6.htm in 2003.

I would like to save as read only, how do I modify the save command below to
do this?

TIA,
Anders

'Change all cells in the worksheet to values if you want
If Destwb.Sheets(1).ProtectContents = False Then
With Destwb.Sheets(1).UsedRange
.Cells.Copy
.Cells.PasteSpecial xlPasteValues
.Cells(1).Select
End With
Application.CutCopyMode = False
End If


'Save the new workbook and close it
With Destwb
.SaveAs FolderName _
& "\" & Destwb.Sheets(1).Name & FileExtStr, _
FileFormat:=FileFormatNum
.Close False
End With

End If


Dave Peterson

Save Archive Copy as Read Only
 
You can save as readonly (give a password to modify).
You can save as readonly recommended without a password.
Or you can change the file's attribute to readonly.

If you want either of the first two, record a macro when you do it manually:
File|SaveAs|Tools|General options.

If you want the last, look at SetAttr in VBA's help.



Anders wrote:

Hi - using RDB6 http://www.rondebruin.nl/copy6.htm in 2003.

I would like to save as read only, how do I modify the save command below to
do this?

TIA,
Anders

'Change all cells in the worksheet to values if you want
If Destwb.Sheets(1).ProtectContents = False Then
With Destwb.Sheets(1).UsedRange
.Cells.Copy
.Cells.PasteSpecial xlPasteValues
.Cells(1).Select
End With
Application.CutCopyMode = False
End If

'Save the new workbook and close it
With Destwb
.SaveAs FolderName _
& "\" & Destwb.Sheets(1).Name & FileExtStr, _
FileFormat:=FileFormatNum
.Close False
End With

End If


--

Dave Peterson


All times are GMT +1. The time now is 10:38 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com