Prich
Messages postés29Date d'inscriptionvendredi 16 mai 2008StatutMembreDernière intervention31 août 2009
-
23 mai 2008 à 15:50
Prich
Messages postés29Date d'inscriptionvendredi 16 mai 2008StatutMembreDernière intervention31 août 2009
-
23 mai 2008 à 21:42
Bonjour,
Comment créer une un bouton "parcourir" qui me permette de recuperer le chemin complet d'un fichier sur mon PC?
bigfish_le vrai
Messages postés1835Date d'inscriptionvendredi 13 mai 2005StatutMembreDernière intervention20 novembre 201315 23 mai 2008 à 16:19
Salut
d'apres trouver sur VBfrance mais je ne me rappel plus l'auteur désolé
Function oldFolderDialog(Root, Optional SelType As Byte = 0)
Dim objShell As Object, objFolder As Object, FolderPath As String, SecuriteSlash, FlagChoix&
Dim msg As String, UserProfil As String
If SelType = 0 Then
FlagChoix = &H1& 'this value specify : folder
msg = "Select Default files location: "
'Else
'FlagChoix = &H4000& 'this value specify : file
'Msg = "Select your file:"
End If
Set objShell = CreateObject("Shell.Application")
'le 3ième paramètre permet de choisir la sélection d'un dossier ou d'un fichier (0 ou 1)
'le dernier paramètre permet de choisir le dossier racine
Set objFolder = objShell.BrowseForFolder(&H0&, msg, FlagChoix, Root)
On Error Resume Next
FolderPath = objFolder.ParentFolder.ParseName(objFolder.Title).Path & ""
UserProfil = Environ("USERPROFILE") If objFolder.Title "My Documents" Or objFolder.Title "Desktop" Then
FolderPath = UserProfil & "" & objFolder.Title
ElseIf objFolder.Title = "" Then
FolderPath = ""
End If
SecuriteSlash = InStr(objFolder.Title, ":")
If SecuriteSlash > 0 Then
FolderPath = Mid(objFolder.Title, SecuriteSlash - 1, 2) & ""
End If
FolderDialog = FolderPath
End Function
ou autre façon
Function FolderDialog(Optional Root As String, Optional FolderDialogTitle As String)
Dim Dossier As String If FolderDialogTitle "" Then FolderDialogTitle "Select Default files location: "
With Application.FileDialog(msoFileDialogFolderPicker)
.Title = FolderDialogTitle
.InitialFileName = Root If .Show -1 Then FolderDialog .InitialFileName
End With
End Function
Sinon il y plein de truc sur le sujet, Code sources, Snipets, Forum etc