ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   read only (https://www.excelbanter.com/excel-programming/330324-read-only.html)

lawson

read only
 
in addition to my previous question, when the file saves over the read only
file, i would like it to make it a read only again.

thanks

Tom Ogilvy

read only
 
that is why VBA provides the setattr command. Read about it in help.

--
Regards,
Tom Ogilvy


"lawson" wrote in message
...
in addition to my previous question, when the file saves over the read

only
file, i would like it to make it a read only again.

thanks




Jim Thomlinson[_4_]

read only
 
Try to keep things in one thread. Makes it easier on all concerned... Give
this code a try...

Public Sub SetReadOnly()
Shell ("Command.com /c Attrib C:\Test.xls +r") 'Make Read Only
Shell ("Command.com /c Attrib C:\Test.xls -r") 'Undo Read Only
End Sub

This uses a file on the C Drive called Test.xls
--
HTH...

Jim Thomlinson


"lawson" wrote:

in addition to my previous question, when the file saves over the read only
file, i would like it to make it a read only again.

thanks


Tom Ogilvy

read only
 
Why resort to shelling a "DOS" command if you can do it fine within VBA?

--
Regards,
Tom Ogilvy


"Jim Thomlinson" wrote in message
...
Try to keep things in one thread. Makes it easier on all concerned... Give
this code a try...

Public Sub SetReadOnly()
Shell ("Command.com /c Attrib C:\Test.xls +r") 'Make Read Only
Shell ("Command.com /c Attrib C:\Test.xls -r") 'Undo Read Only
End Sub

This uses a file on the C Drive called Test.xls
--
HTH...

Jim Thomlinson


"lawson" wrote:

in addition to my previous question, when the file saves over the read

only
file, i would like it to make it a read only again.

thanks




Jim Thomlinson[_4_]

read only
 
it is just a different way of skinng the same cat. I agree with you on the VB
function. Sometimes dos is kind of handy though (and I remember it better
than some of the functions in VB).
--
HTH...

Jim Thomlinson


"Tom Ogilvy" wrote:

Why resort to shelling a "DOS" command if you can do it fine within VBA?

--
Regards,
Tom Ogilvy


"Jim Thomlinson" wrote in message
...
Try to keep things in one thread. Makes it easier on all concerned... Give
this code a try...

Public Sub SetReadOnly()
Shell ("Command.com /c Attrib C:\Test.xls +r") 'Make Read Only
Shell ("Command.com /c Attrib C:\Test.xls -r") 'Undo Read Only
End Sub

This uses a file on the C Drive called Test.xls
--
HTH...

Jim Thomlinson


"lawson" wrote:

in addition to my previous question, when the file saves over the read

only
file, i would like it to make it a read only again.

thanks






All times are GMT +1. The time now is 06:00 PM.

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