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
 

Some videos you may like

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!

danial

Board Regular
Joined
Apr 29, 2006
Messages
107
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]
 

MrT82

Board Regular
Joined
Dec 12, 2005
Messages
84
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
 

Watch MrExcel Video

Forum statistics

Threads
1,109,383
Messages
5,528,385
Members
409,817
Latest member
JiNXX9500

This Week's Hot Topics

  • Change military grades into rank
    Afternoon all Need help with formula that will change military rank (i.e. 1, 2, 3 into Amn, A1C, SrA). Running IF formula that does not work...
  • VBA COUNTIF SOLUTION
    Hi The following are the errors spread across the several columns from E to Q ie. 13 columns across several sheets with more than 500 rows per...
  • INSERT ROW WITH SPECIFIS TEXT IN A COLUMN
    Hi All! How can identify that that the row to be inserted has to be inserted before 1st row with specific text in column F. If I record the...
  • Auto-Create a monthly Sign in sheet for preschool students
    The image below is what each page looks like. Above is space for the "Child Name" "Month" "Class" School days are obviously Monday-Friday but...
  • VBA vlookup multiple results
    Hi folks, Hopefully someone out there can help. I have a list to vlookup which works (ish). the lookup only picks up the first instance of the...
  • Extract values for earliest/latest times
    I am trying to put together a formula to get the earliest start time, the latest end time from column A for each person in Column B-F without the...
Top