Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Smart Folder Creation

Status
Not open for further replies.

crackoo

Programmer
Feb 17, 2011
132
TN
Hi !
I found a Helpful Tip ! Thanks to the Author ebgreen and i want to share with you this code, may be help somebody else (-_°)
This Sub will create a folder and the entire path to the folder if needed.

Code:
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  ''    
  ''    Sub SmartCreateFolder(strFolder)
  ''    Author:        ebgreen
  ''    Purpose:    Creates a folder building the entire path if needed.
  ''    Takes:        strFolder - The complete path of the folder to create
  ''    Returns:    Nothing
  ''    Revision History:
  ''        12/23/05    RMD    Created
  ''
  ''    To Do:
  ''        Nothing at present
  ''
  '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  Sub SmartCreateFolder(strFolder)
      Dim oFSO:Set oFSO = CreateObject("Scripting.FileSystemObject")
      If oFSO.FolderExists(strFolder) Then
          Exit Sub
      Else
          SmartCreateFolder(oFSO.GetParentFolderName(strFolder))
      End If
      oFSO.CreateFolder(strFolder)
      Set oFSO = Nothing    
  End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top