View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
steve steve is offline
external usenet poster
 
Posts: 576
Default Checking to see if Folder exists

Dan,

Ron posted this on the 17th...

Sub MakeDirectory()
Dim Dirname As String
Dim fs As Object
Set fs = CreateObject("Scripting.FileSystemObject")
Dirname = "C:\Data"
If Not fs.FolderExists(Dirname) Then
fs.CreateFolder Dirname
' your code
Else
' your code
End If
End Sub


--
Regards Ron de Bruin


--
sb
"Dan" wrote in message
...
In my macro I need to check to see if a folder exists b/4 I create one.

What
command should I use? Does anyone have some quick code to check if a

folder
exists and if not, create it?

Dan