cs_lecorsaire59
Messages postés39Date d'inscriptionmardi 9 octobre 2007StatutMembreDernière intervention17 octobre 2008
-
24 oct. 2007 à 14:33
cs_lecorsaire59
Messages postés39Date d'inscriptionmardi 9 octobre 2007StatutMembreDernière intervention17 octobre 2008
-
24 oct. 2007 à 17:42
bonjour a tous,
je suis sur vba. je cherche à pouvoir ouvrir une fenetre (type de celle que l'on a lorsqu'on fait sur excel fichier/ouvrir) qui me permettrait d'aller choisir un dossier cible dans lequelle je copierai des fichiers.
autrement dit :
- j'ai une cellule B10 dans lequel il doir y avoir un chemin d'accès à un dossier(qui contiendra des fichiers crée par mon application)
- afin d'optimiser mon fichier je souhaiterai créer une commande qui me permettrai de copier le chemin d'accès du dossier souhaité
j'ai copié
Private Sub cmdmodif_Click()
test = Application.Dialogs(xlDialogFindFile).Show
If test = True Then
temp = ActiveWorkbook.Path & "" & Activefile.Name
ActiveWorkbook.Close False
If temp <> "" Then
Cells(10, 2) = temp
ActiveWorkbook.Save
End If
End If
End Sub
cs_lecorsaire59
Messages postés39Date d'inscriptionmardi 9 octobre 2007StatutMembreDernière intervention17 octobre 2008 24 oct. 2007 à 15:26
j'ai trouvé sur un autre tchat avis aux amateurs:
Private Sub cmdBrowse_Click()
Dim objShell, objFichier, objFichierChoisi
Set objShell = CreateObject("Shell.Application")
Set objFichier = objShell.BrowseForFolder(&H0&, "Choisir le fichier", conReturnOnlyFSDirs + conNoNewFolderButton + conBrowseIncludeFiles)
If objFichier Is Nothing Then
MsgBox "Vous n'avez rien sélectionné", vbCritical, "Abandon"
Wscript.Quit
Else
Set objFichierChoisi = objFichier.Self
Cells(10, 2) = objFichierChoisi.Path
End If
Set objShell = Nothing
Set objFichier = Nothing
Set objFichierChoisi = Nothing