Creating & deleting file folders

WangYa

New Member
Joined
Mar 25, 2002
Messages
1
In my application I have to use a folder temporary (thus called TEMP). After use I like to delete this folder.
Is it possible in Excel VBA to create and delete a file folder?
 

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).
Hi,

You can try using the following:

to create folders:
mkdir "C:temp"

and to delete folders:

rmdir "c:temp"

HTH
 
Upvote 0
On 2002-03-26 18:16, BabyTiger wrote:
Hi,

You can try using the following:

to create folders:
mkdir "C:temp"

and to delete folders:

rmdir "c:temp"

HTH

BabyTiger the rmdir won't work if the Dir
has files in them....you can do this though

Sub RemoveDir_WithFiles()
Dim Fs As Object

On Error GoTo DelErr
'CAUTION: Will delete entire Folder NO PROMPT
Set Fs = CreateObject("Scripting.FileSystemObject")
Fs.DeleteFolder "C:mydir", True

Exit Sub
DelErr:
MsgBox Err.Number & vbCr & _
Err.Description
End Sub



Ivan
 
Upvote 0

Forum statistics

Threads
1,213,546
Messages
6,114,256
Members
448,557
Latest member
richa mishra

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