parcourir

P

PY

Guest
Bonjour a tous

j'ai un bouton parcourir et quand je clique dessus je voudrais afficher la boite de dialogue window parcourir et récuprer le chemin sélectionner dans une variable comment faire ?

merci
 
F

Fred

Guest
slt ,essaye d'utiliser ca :

Private Function ChoisirDossier()
Dim objShell, objFolder, chemin, SecuriteSlash

Set objShell = CreateObject("Shell.Application")
Set objFolder = _
objShell.BrowseForFolder(&H0&, "Choisisser un répertoire", &H1&)
On Error Resume Next
chemin = objFolder.ParentFolder.ParseName(objFolder.Title).Path & ""
If objFolder.Title = "Bureau" Then
chemin = "C:\Windows\Bureau"
End If
If objFolder.Title = "" Then
chemin = ""
End If

SecuriteSlash = InStr(objFolder.Title, ":")

If SecuriteSlash > 0 Then
chemin = Mid(objFolder.Title, SecuriteSlash - 1, 2) & ""
End If
ChoisirDossier = chemin
End Function

Sub test()
MsgBox (ChoisirDossier)
End Sub
 
P

PY

Guest
merci fred

c'est exactement ce que je voulais mais comment faire pour récuperer le chemin selectionner et le placer dans un textbox ( en fait je me ressers du textbox dans un autre sub
chemin = textbox(qui contient mon chemin d'acces).text.value
et dans l'autre sub je marque

myfilename = chemin & Range("F10") & " " & Range("C12").Value & ".xls":
 
F

Fred

Guest
Essaye ca:

Private Function ChoisirDossier()
Dim objShell, objFolder, chemin, SecuriteSlash

Set objShell = CreateObject("Shell.Application")
Set objFolder = _
objShell.BrowseForFolder(&H0&, "Choisisser un répertoire", &H1&)
On Error Resume Next
chemin = objFolder.ParentFolder.ParseName(objFolder.Title).Path & ""
If objFolder.Title = "Bureau" Then
chemin = "C:\Windows\Bureau"
End If
If objFolder.Title = "" Then
chemin = ""
End If

SecuriteSlash = InStr(objFolder.Title, ":")

If SecuriteSlash > 0 Then
chemin = Mid(objFolder.Title, SecuriteSlash - 1, 2) & ""
End If
ChoisirDossier = chemin
End Function


Sub fichier-chemin ()

textbox.value = ChoisirDossier
myfilename = ChoisirDossier & "\" & Range("C12").Value & ".xls"

End Sub
 

Discussions similaires

Réponses
1
Affichages
100

Membres actuellement en ligne

Statistiques des forums

Discussions
312 177
Messages
2 085 972
Membres
103 073
dernier inscrit
MSCHOE16