View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
AA2e72E AA2e72E is offline
external usenet poster
 
Posts: 400
Default How to: check if folder exist, if not, create

The code is:

Private Declare Function MakeSureDirectoryPathExists Lib "imagehlp.dll" (ByVal lpPath As String) As Long

Sub CreateFolder()
MakeSureDirectoryPathExists Application.DefaultFilePath & "\YOURFOLDER\"
End Sub

where \YOURFOLDER\ is the name of the folder whose existence you want to ensu note trailing \.


"escorido " wrote:

Hello to all,

How to check if the folder exist in the ActiveWorkbook.Path directory,
if it doesn't, create the folder there?

Could anyone show some sample codes on how to do this?
I'm still new to ExcelVBA and not familiar with it.

Thanks a lot!


---
Message posted from http://www.ExcelForum.com/