Testing for a directory

M

MarkS

Hi,
I need to test if a directory exists and if not create it. All I can think
of is to use on error and try and open it, they create a new directory if it
fails.
Any sugestions of a more elegant way
 
N

Nigel

This works for me.....

Dim sFolder As String
sFolder = "C:\NewFolder"

If Dir(sFolder, vbDirectory) = "" Then MkDir sFolder
 
B

Bob Phillips

Just create it with error warp

On Error Resume Next
MkDir myDir
On Error Goto 0
 
Top