Private Sub CommandButton1_Click()
DossierRapportDeMicrosection = "D:\info travail\Macro\rapport de microsection"
Dim fs, f, f1, fc, s
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.GetFolder(DossierRapportDeMicrosection)
Set fc = f.SubFolders
For Each f1 In fc
If TextBox1.Value = f1.Name Then
[COLOR="Red"]DossierChoisiRapportDateCode = f1[/COLOR]
Label2.Caption = f1
found = True
End If
Next f1
If found = False Then
Label2.Caption = "Pas de code article correpondant au nom specifie"
End If
End Sub
Private Sub CommandButton2_Click()
If Label2.Caption = "" Then
MsgBox "Merci de lancer la verification de dossier." & vbCr & vbCr & "Veuillez cliquer sur 'Verifier le dossier' avant de lancer l'ouverture automatique.", vbExclamation
Exit Sub
ElseIf Label2.Caption = "Pas de dossier correpondant au nom specifie" Then
MsgBox "Pas de dossier valide." & vbCr & vbCr & "Veuillez indiquer un nom de dossier valide et relancer la recherche de dossier avant de lancer l'ouverture automatique.", vbExclamation
Exit Sub
End If
[COLOR="Red"]
dossierRapportdatecode = DossierChoisiRapportDateCode[/COLOR]
Dim fs, f, f1, fc, s
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.GetFolder(dossierRapportdatecode)
Set fc = f.SubFolders
For Each f1 In fc
If TextBox2.Value = f1.Name Then
DossierChoisi = f1
Label4.Caption = f1
found = True
End If
Next f1
If found = False Then
Label4.Caption = "Pas de dossier correpondant au nom specifie"
End If
End Sub