Making folders read only and deleting folders

MrT82

Board Regular
Joined
Dec 12, 2005
Messages
84
Hi All,

This isn't really an excel specific query, but a macro ran through it can probably be used...

Does anyone know of a piece of code i can run that will automatically making certain folders on my PC as read only and delete certain other folders/files.

Any ideas?

Ta,

Paul
 

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!
I'm not sure, is this you want?
Code:
MkDir ("C:\YourFolder")
SetAttr "C:\YourFolder", vbReadOnly

You can read form help by press F1 @ your VBA page[/code]
 
Upvote 0
Hi All,

Sorry it's been a while.

Thanks Danail for providing the above. I can get the SetAttr line to work if i want a particular file to be readonly, but i can't get it to work if i want all files in a folder. Any ideas?

Thanks,

Paul
 
Upvote 0

Forum statistics

Threads
1,213,510
Messages
6,114,037
Members
448,543
Latest member
MartinLarkin

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top