PB Combbox

jmsonnet

XLDnaute Nouveau
Bonjour à vous voila mon probléme est que je voudrais inserer le résultat d'une combobox pour completer mon chemin de recherche qui utlise la fonction .lookin et sa plante merci de votre aide.
jm
voici le code

Private Sub CommandButton1_Click()
Dim i As Integer
Dim j As Variant

j = ComboBox1.Value


With Application.FileSearch
.NewSearch
.LookIn = "C:\Documents and Settings\jeanmimi\Bureau\MBR\Suivi-BT-HV\" & "j"
.SearchSubFolders = True
.Filename = "*" 'pour une cellule Range("b3")
If UserForm1.ComboBox1.Text = "" Then
MsgBox "Vous n'avez pas saiside model;" & Chr(10) & "Recommencez! "
Exit Sub
End If

ComboBox1.Text = ""
End With

With Application.FileSearch
If .Execute() > 0 Then
MsgBox .FoundFiles.Count & " Fichier(s) trouvé(s) "
Range("A6").Select
For i = 1 To .FoundFiles.Count
ActiveCell.Value = .FoundFiles(i)
ActiveCell.Offset(1, 0).Range("A1").Select
Next i
Else
MsgBox "Aucun fichier correspondant à ce critère"
End If
Unload UserForm1
UserForm2.Show
' Loop through the array and fill the list box on the UserForm.
'For i = 1 To fs.FoundFiles.Count
UserForm2.ListBox1.AddItem (i)
'Next i

End With
End Sub:)
 

jmsonnet

XLDnaute Nouveau
Re : PB Combbox

Bonjour pierrejean

ma question et toute bete le PB est que dans :


j = ComboBox1.Value


With Application.FileSearch
.NewSearch
.LookIn = "C:\Documents and Settings\jeanmimi\Bureau\MBR\Suivi-BT-HV\" & "j"

.looking ne comprend pas qu'il faut rajouter la valeur de la variable "j" qui en faite et le nom d'un sousdossier
 

ERIC S

XLDnaute Barbatruc
Re : PB Combbox

re

.LookIn = "C:\Documents and Settings\jeanmimi\Bureau\MBR\Suivi-BT-HV\" & combobox1.value

devrait fonctionner, sans variable intermédiaire j, si ton chemin en dur "..." n'est pas erroné et si combobox1.value est cohérent
 

Discussions similaires

Statistiques des forums

Discussions
312 428
Messages
2 088 325
Membres
103 813
dernier inscrit
Lolo280277