VB6

Résolu
Prich Messages postés 29 Date d'inscription vendredi 16 mai 2008 Statut Membre Dernière intervention 31 août 2009 - 23 mai 2008 à 15:50
Prich Messages postés 29 Date d'inscription vendredi 16 mai 2008 Statut Membre Dernière intervention 31 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?

Merci
A voir également:

3 réponses

bigfish_le vrai Messages postés 1835 Date d'inscription vendredi 13 mai 2005 Statut Membre Dernière intervention 20 novembre 2013 15
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

A+
3
mortalino Messages postés 6786 Date d'inscription vendredi 16 décembre 2005 Statut Membre Dernière intervention 21 décembre 2011 18
23 mai 2008 à 16:35
salut,

il y a également mon UserControl
http://www.vbfrance.com/codes/COMMONDIALOG-AVEC-PREVIEW-IMAGE-USERCONTROL_42387.aspx

Si c'est une image, la miniature de celle-ci s'affiche
@++

le mystérieux chevalier,"Provençal, le gaulois"
Forum Office & VBA
0
Prich Messages postés 29 Date d'inscription vendredi 16 mai 2008 Statut Membre Dernière intervention 31 août 2009
23 mai 2008 à 21:42
merci
0
Rejoignez-nous