cs_BFR
Messages postés88Date d'inscriptionmardi 30 juillet 2002StatutMembreDernière intervention 1 mars 2008 20 janv. 2004 à 15:09
'-Tester dans une feuille sous Excel
'-EXPLORATEUR************************************************************
'*******' DECLARATION DES API '********'
Private Declare Function SHBrowseForFolder Lib "shell32.dll" Alias "SHBrowseForFolderA" (lpBrowseInfo As BROWSEINFO) As Long
Private Declare Function SHGetPathFromIDList Lib "shell32.dll" Alias "SHGetPathFromIDListA" (ByVal pidl As Long, ByVal pszPath As String) As Long
'*******' DECLARATION DES API '********'
'*******' DECLARATION DES CONSTANTES '********'
Private Const BIF_RETURNONLYFSDIRS = &H1
Private Const BIF_STATUSTEXT = &H4
'*******' DECLARATION DES CONSTANTES '********'
'*******' DECLARATION DES TYPES '********'
Private Type BROWSEINFO 'bi
hOwner As Long
pidlRoot As Long
pszDisplayName As String
lpszTitle As String
ulFlags As Long
lpfn As Long
lParam As Long
iImage As Long
End Type
Private Type SHITEMID 'mkid
cb As Long
abID As Byte
End Type
Private Type ITEMIDLIST 'idl
mkid As SHITEMID
End Type
Private Sub CommandButton1_Click()
Dim toto
toto = EXPLORATEUR("Recheche Fichier")
End Sub
Public Function EXPLORATEUR(Optional TexteInfo As String) As String
'-***Appeler l'explorateur***
'-Créer le ?
'-MAJ le 28/01/2002
'-Déclarations
Dim bi As BROWSEINFO
Dim IDL As ITEMIDLIST
Dim pidl As Long
Dim Retval As Long
Dim Pos As Long
Dim Rep_Select As String 'Chemin du répertoire sélectionné
With bi
.hOwner = 0 'Frm.Hwnd '0 (zéro)ou Me.hWnd si on a une Feuille par exemple
.pidlRoot = 0&
.lpszTitle = TexteInfo '-Texte d'info de la feuille
.ulFlags = BIF_RETURNONLYFSDIRS + BIF_STATUSTEXT
End With
'-Espace réservé pour la variable
Rep_Select = Space(512)
If Retval Then
'-Recherche la position du caractère (Chr(0))
Pos = InStr(Rep_Select, Chr(0))
'-Selectionne le chemin du dossier à gauche sans le(Chr(0))
'et renvoie dans la fonction
EXPLORATEUR = Left(Rep_Select, Pos - 1)
End If
cs_sammy007
Messages postés1Date d'inscriptionlundi 7 février 2005StatutMembreDernière intervention 7 février 2005 7 févr. 2005 à 11:54
Bonjour à Tous,
J'ai bien utilisé ce petit prog qui est excellent, toutefois, j'ai besoin de rechercher des fichiers. Existe t-il un moyen de voir le nom des fichiers en plus des dossiers ?