|
|
CODE ' Code courtesy of UtterAccess Wiki ' http://www.utteraccess.com/wiki/index.php/Category:FunctionLibrary ' Original submission by Pacala_Ba ' 2010, August 11th ' ' You are free to use it in any application, ' provided this copyright notice is left unchanged. ' ' ' 'Include these Declarations at module level: ' 'Private Declare Function MakeSureDirectoryPathExists _ ' Lib "imagehlp.dll" (ByVal lpPath As String) As Long ' 'Private Declare Function PathAddBackslash _ ' Lib "shlwapi.dll" Alias "PathAddBackslashA" _ ' (ByVal pszPath As String) As Long ' ' ' ' --------------------- Example calls ----------------- ' SysVerifyPathExists...if Path NOT Exists, than Path is CREATED '? SysVerifyPathExists("D:\__TEST_FullPath\Folder1\Folder2\Folder3") ' ' Dir...if Path NOT Exists, than Path is NOT CREATED '? (Len(Dir("D:\__TEST_FullPath\Folder1\Folder2\Folder3",vbDirectory or vbHidden))>0) ' ' ' Public Function SysVerifyPathExists(cFullPath As String) As Boolean On Error GoTo LBL_xPAC_ERR Dim lc_PATH As String If Len(cFullPath) > 0 Then lc_PATH = cFullPath If PathAddBackslash(lc_PATH) > 0 Then SysVerifyPathExists = (MakeSureDirectoryPathExists(lc_PATH) > 0) End If Else Err.Raise 1111, "SysVerifyPathExists", "*EMPTY* Path !" End If LBL_xPAC_END: Exit Function LBL_xPAC_ERR: MsgBox "Err: " & Err & "," & Err.Description, vbCritical, "SysVerifyPathExists" Resume LBL_xPAC_END Resume Next Resume End Function
|
| This page was last modified 09:43, 6 April 2011. This page has been accessed 640 times. Disclaimers |