View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.misc
Farhad Farhad is offline
external usenet poster
 
Posts: 281
Default Create Folder Using VBA

Hi,

Try this:

Dim Fldr As Scripting.FileSystemObject
Set Fldr = New Scripting.FileSystemObject
If Fldr.FolderExists("C:\Reports\2007-09-18") Then
Else
Fldr.CreateFolder "C:\Reports\2007-09-18"
End If

make sure you have referred to MicroSoft Scripting Runtime from
ToolsReferences

Thanks,
--
Farhad Hodjat


"DoooWhat" wrote:

I would like to create a folder using the values in a specific cell on
a worksheet. Let's say, for instance, that the value of A1 is: C:
\Reports\2007-09-18

The 'Reports' directory MAY OR MAY NOT already have a '2007-09-18'
folder. I would like the code to be conditional, in that it will
create the folder if it does not exist, otherwise don't do anything.
Any help is much appreciated.

Thanks.

Kevin