Clear contents from the "Excel Folder" in the drive C

kelly mort

Well-known Member
Joined
Apr 10, 2017
Messages
1,799
Office Version
  1. 2016
Platform
  1. Windows
Hello Geniuses,

How do I locate and clear the contents of the "Excel Folder" located under the "AppData" folder?

I mean with a vba code.

Thanks
 

Some videos you may like

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.

kelly mort

Well-known Member
Joined
Apr 10, 2017
Messages
1,799
Office Version
  1. 2016
Platform
  1. Windows
Okay. Thanks was very helpful

Just that I am not able to write the script that will locate the folder then delete all the contents of that folder.

I am still working on it. If someone can help in will be glad:LOL:
 
Last edited:

Logit

Well-known Member
Joined
Aug 31, 2016
Messages
3,610
.
This should do it.

Code:
<code style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; font-family: Consolas, Menlo, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace, sans-serif; vertical-align: baseline; box-sizing: inherit; white-space: inherit;">[COLOR=#303336][FONT=inherit]Sub Del()
  Kill "C:\FolderName\*.*"
End Sub[/FONT][/COLOR]</code>

Change FolderName to the actual name of the folder. If the files you want to delete are further 'down' ... located in other folders,
you will need to provide the full path to the folder where the files are located.

Ex: "C:\Folder 1\Folder 2\Folder 3 (This is the folder where the files are located)"
 

Watch MrExcel Video

Forum statistics

Threads
1,109,543
Messages
5,529,456
Members
409,878
Latest member
DDhol
Top