You can do that via one API call:
VB Code:
  1. Option Explicit
  2.  
  3. Private Declare Function MakeSureDirectoryPathExists _
  4.     Lib "imagehlp.dll" (ByVal lpPath As String) As Long
  5.  
  6. Private Sub Command1_Click()
  7.     'NOTE: make sure complete path ends with backslash
  8.     MakeSureDirectoryPathExists "c:\dir1\subdir1\subdir2\"
  9. End Sub