View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Dan R. Dan R. is offline
external usenet poster
 
Posts: 220
Default Check for directory then create

Try this function:

Function DirExists(PathName As String) As Boolean
Dim temp As Integer
On Error Resume Next
temp = GetAttr(PathName)
If Err.Number = 0 Then
DirExists = True
Else
DirExists = False
End If
On Error GoTo 0
End Function

--
Dan

On Dec 17, 3:07 pm, Rex Mundi wrote:
I have figured out how to have Excel create a directory and save a CSV
of the current workbook.

Now the macro hangs if the directory already exists. How do I check
for the directory and create only if needed.

TIA