mdeg
Messages postés28Date d'inscriptionmercredi 31 mars 2010StatutMembreDernière intervention29 avril 2010
-
31 mars 2010 à 21:01
bouchaibkiki
Messages postés2Date d'inscriptionlundi 7 juin 2010StatutMembreDernière intervention20 décembre 2010
-
20 déc. 2010 à 22:12
Bonjour,
Je souhaite afficher dans une listebox le contenu d'un fichier txt du type
Private Sub CommandButton_Ouvrir_Click()
Dim Fichier
Fichier = Application.GetOpenFilename("Fichier Texte (*.txt), *.txt")
If Fichier = False Then Exit Sub
If Fichier Like "*" & ThisWorkbook.Name Then MsgBox "Ouverture non autorisée.": Exit Sub
On Error Resume Next
Open Fichier For Input As #1
On Error GoTo 0
Dim Ligne As String
Dim Valeur As Variant
Dim Separateur As String
Input #1, Ligne
Separateur = InputBox("Entrer le séparateur de données : " & Ligne, "Séparateur")
While Not (EOF(1))
Input #1, Ligne
Valeur = Split(Ligne, Separateur)
ListBox_Points_Homologues.AddItem (Valeur(0))
ListBox_Points_Homologues.List(ListBox_Points_Homologues.ListCount - 1, 1) = Valeur(1)
ListBox_Points_Homologues.List(ListBox_Points_Homologues.ListCount - 1, 2) = Valeur(2)
ListBox_Points_Homologues.List(ListBox_Points_Homologues.ListCount - 1, 3) = Valeur(3)
ListBox_Points_Homologues.List(ListBox_Points_Homologues.ListCount - 1, 4) = Valeur(4)
Wend
Close #1
End Sub
Le probléme lorsque je l'execute est qu'il me manque la première ligne du fichier texte dans la listbox.
Est ce que quelqu'un pourrait m'aider à résoudre ce probléme?