affichage de fichier

gildas lechat

XLDnaute Occasionnel
Bonjour le forum:),

Vous trouverez ci joint un extrait d'une macro me permettant d'afficher sur le label3 le chemin d'acces d'un fichier.
Ca fonctionne bien:D.

J'aimerai pouvoir afficher en plus dans un listbox1 l'ensemble des fichiers existant dans le dossier "(DossierRapportDeContolefinal & TextBox1.Value )"

Public DossierChoisi
Private Sub CommandButton1_Click()
DossierRapportDeContolefinal = "\\ml350\production\Atelier CONTROLES\Rapport de controle final\" 'Remplacer le dossier source de recherche de rapport

NOMREP = Dir(DossierRapportDeContolefinal & TextBox1.Value & "\a-*")
If NOMREP = "" Then
Label3.Caption = "Pas de dossier correspondant au nom specifie"
Else
Label3.Caption = "\\ML350\Production\Atelier CONTROLES\Rapport de controle final\" & TextBox1.Value & "\" & NOMREP 'A adapter
Found = True
End If
End Sub

Merci pour votre aide
Gildas
 

Pièces jointes

  • Classeur1.xls
    24.5 KB · Affichages: 43
  • Classeur1.xls
    24.5 KB · Affichages: 42
  • Classeur1.xls
    24.5 KB · Affichages: 43

James007

XLDnaute Barbatruc
Re : affichage de fichier

Bonjour,

A tester et à adapter ...
Code:
Private Sub UserForm_Initialize()
 Dim strDirectory As String
 Dim strFile As String
 Dim lb As MSForms.ListBox
 Dim i As Integer
 strDirectory = InputBox("Choisir le Répertoire", "Fichiers", "\\ml350\production\Atelier CONTROLES\Rapport de controle final\")
 If strDirectory = "" Then Exit Sub
    ChDrive Left(strDirectory, 1)
    ChDir strDirectory
    strFile = Dir("*.xls")
 Set lb = UserForm1.ListBox1
    Do Until strFile = ""
        i = i + 1
        lb.AddItem strFile
        strFile = Dir()
    Loop
End Sub

A +
 

Discussions similaires

Statistiques des forums

Discussions
312 532
Messages
2 089 374
Membres
104 150
dernier inscrit
pape.so