View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
NickHK NickHK is offline
external usenet poster
 
Posts: 4,391
Default How to determine if a Folder/Directory Exists in Excel VBA

Bill,
Dave's answer is native VBA, but there's also the API route:

<From API-Guide: URL: http://www.allapi.net/
Private Declare Function MakeSureDirectoryPathExists Lib "imagehlp.dll"
(ByVal lpPath As String) As Long

Private Sub Form_Load()
'create the directory "c:\this\is\a\test\directory\", if it doesn't exist
already
MakeSureDirectoryPathExists "c:\this\is\a\test\directory\"

End Sub
</From API-Guide:

NickHK

wrote in message
oups.com...
Hi All,

Does anybody know how i can determine if a directory exists in VBA? For
example i would like to write a function that looks to see if the path
c:\reports\2006 exists, if so leave it be, if not create it.

Thanks,
Bill