View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Open a new Directory

No need to leave VBA to do it. With On Error you don't need to check if it
exists either

On Error Resume Next
mkdir "C:\MyDir"
On Error goto 0


'
'
'

On Error Resume Next
Kill "C:\MyDir\*.*"
rmdir "C:\MyDir"
On Error goto 0

Assumes MyDir has no subdirectories.

--
Regards,
Tom Ogilvy


"CLR" wrote in message
...
Thanks Bob.........I actually meant "Create" a directory, not just "open"
one as I posted.......that's what happens when you get old <g..........

I suppose we also have to first determine if one exists by that
name........then, if not, Create a new one, if it does, then delete the
existing one and re-create it?..........

This stuff makes my head hurt..........

Vaya con Dios,
Chuck CABGx3



We're trying to decern what we want from what you sent anyway,
"Bob Phillips" wrote in message
...
Chuck,

What do you mean by open a directory?

To delete one, try

Dim FSO As Object

Set FSO = CreatObject("Scripting.FileSystemObject")
FSO.DeleteFolder "C:\MyDir" , force:=True



--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"CLR" wrote in message
...
Hi All..........

Would someone please be so kind as to tell me the code to open a new
directory on my C:\ drive?......and also please, the code to delete

it.

Thanking you very much.

Vaya con Dios,
Chuck, CABGx3