Save file as Read-Only

  • Thread starter Thread starter Otto Moehrbach
  • Start date Start date
O

Otto Moehrbach

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
 
maybe something like this, just use your own variables:

Workbooks(wb).SaveAs Filename:=fPath & fName, ReadOnlyRecommended:=True
 
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?
 
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" <[email protected]>
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
 
Back
Top