j'ai pu constater que toutes les solutions disponibles dans mes recherches generent le meme faux positif lorsqu'on chercher a tester un dossier.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28 Public Function FileFolderExists(strFullPath As String) As Boolean 'Author : Ken Puls (www.excelguru.ca) 'Macro Purpose: Check if a file or folder exists On Error GoTo EarlyExit If Not Dir(strFullPath, vbDirectory) = vbNullString Then FileFolderExists = True EarlyExit: On Error GoTo 0 End Function Function FolderExists(strPath As String) As Boolean On Error Resume Next FolderExists = ((GetAttr(strPath) And vbDirectory) = vbDirectory) End Function Public Function ExistFolder(Folder$) As Boolean Dim oFSO As Scripting.FileSystemObject On Error GoTo ERROR_TRAP Set oFSO = New Scripting.FileSystemObject ExistFolder = oFSO.FolderExists(Folder) Set oFSO = Nothing Exit Function ERROR_TRAP: Set oFSO = Nothing DebugPrint "ERROR : was unable to check existance of directory : " & Folder End Function
Les fausx positifs arrivant pour les valeurs (entres autres je suppose)
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3 ' ExistFolder(".")=true ' ExistFolder("\")=true ' ExistFolder("/")=true
Est-ce que certains parmi vous ont deja constate et resolu ce probleme ?
Merci d'avance.
Partager