![]() |
Save file as Read-Only
Excel XP & Win XP
I need to save a file in VBA and set the attribute to Read-Only. I know how to save it but don't know how to set the attribute. What is the correct code for that? Thanks for your time. Otto |
Save file as Read-Only
maybe something like this, just use your own variables: Workbooks(wb).SaveAs Filename:=fPath & fName, ReadOnlyRecommended:=True -- Gary "Otto Moehrbach" wrote in message ... Excel XP & Win XP I need to save a file in VBA and set the attribute to Read-Only. I know how to save it but don't know how to set the attribute. What is the correct code for that? Thanks for your time. Otto |
Save file as Read-Only
Gary
Thanks for your time. That didn't set the attribute such that when you right-click on the file name - properties, you see the Read-Only box checked. What it did create was a query when the file is opened asking if you want to open it as Read-Only. Do you know of a way to make the file Read-only such that when you open it, it is Read-only, period? "Gary Keramidas" <GKeramidasATmsn.com wrote in message ... maybe something like this, just use your own variables: Workbooks(wb).SaveAs Filename:=fPath & fName, ReadOnlyRecommended:=True -- Gary "Otto Moehrbach" wrote in message ... Excel XP & Win XP I need to save a file in VBA and set the attribute to Read-Only. I know how to save it but don't know how to set the attribute. What is the correct code for that? Thanks for your time. Otto |
Save file as Read-Only
Otto,
The SetAttr statement only works on closed files... Sub DoItToIt() SetAttr "C:\My Documents\Word & Text Docs\MyFile.doc", vbReadOnly End Sub -- Jim Cone San Francisco, USA http://www.realezsites.com/bus/primitivesoftware "Otto Moehrbach" wrote in message Excel XP & Win XP I need to save a file in VBA and set the attribute to Read-Only. I know how to save it but don't know how to set the attribute. What is the correct code for that? Thanks for your time. Otto |
All times are GMT +1. The time now is 12:07 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com