J
juliette
Guest
Bonjour le forum...
c'est l'heure du déjeuner mais je me retrouve fasse à un problème qui me contraint à sauter ce repas... hihi, je sais c'est pas bien mais Excel quand tu nous tiens... lol
je vous présente mon pb.
dans l'une des multiples exquises démo de notre ami Thierry, j'ai récupérer un code me permettant notamment de renseigner dans une listbox des données obtenues grâce à une recherche effectuée dans une database txt préalablement sélectionnée...
pour les amateurs, la démo est : "Thierry's search engine v02"
(je ne me souviens plus du file)
les données souhaitées apparaisent bien dans la listbox cependant, les informations ne sont séparées que d'un espace ou un quelconque caractère.
La listbox se présente alors ainsi:
Pierre informaticien 10 ans
Frédérique pharmacienne 8 ans
Eric SP 2 mois
...
Je souhaite en fait aligner les informations sous forme de 3 colonnes.
Voici le code de Thierry:
"Private Sub CmdOKStandard()
Dim Cell As Range
Dim StringSearch As String
Dim FirstAddress As String
Dim Item
CleanStringFound
F = 0: x = 0: Total = 0
If Me.LblTXTSelected = "Selection" Or OpenFile = "" Then
Me.MultiPage1.Value = 1
Me.LblRed.Visible = True
Exit Sub
End If
With Me
StringSearch = .TxBString
If StringSearch = "" Then: .TxBString = "Cannot Be Empty": Exit Sub
End With
With USF1
.LbxString.Clear
.LblRecords = ""
.LblScan = ""
End With
With Range(RangeSearch)
Set Cell = .Find(StringSearch, LookIn:=xlValues, lookat:=xlPart)
If Not Cell Is Nothing Then
FirstAddress = Cell.Address
Do
x = x + 1
Me.LblScan = "Scanning " & x & " records"
If Me.OpbNick = True Then
On Error Resume Next
StringFound.Add Cell.Offset(0, -ColOffset).Text & "# : " & Cell.Text & " | :" & Cell.Offset(0, 1).Text, _
Cell.Offset(0, -ColOffset).Text & "# : " & Cell.Text & "| :" & Cell.Offset(0, 1).Text
Else
On Error Resume Next
StringFound.Add Cell.Offset(0, -ColOffset).Text & "# : " & Cell.Text, _
Cell.Offset(0, -ColOffset).Text & "# : " & Cell.Text
End If
DoEvents
Me.LblRecords = "Reccords " & x
Set Cell = .FindNext(Cell)
Loop While Not Cell Is Nothing And Cell.Address <> FirstAddress
End If
End With
If x = 0 Then Me.LblRecords = "No Item found": Exit Sub
For Each Item In StringFound
With USF1
.LbxString.AddItem Item
F = F + 1
End With
Next
With USF1
.LblScan = "Filtered Records " & F
End With
If F > 0 Then
With Me
.LblFineSearch.Visible = True
.TxbFineString.Visible = True
.CmdFineSearch.Visible = True
.TxbFineString.SetFocus
End With
End If
End Sub"
je n'ai pas réussi à y intégrer les notion de "ColumnCount " et de "ColumnWidths".
Merci d'avance pour votre éventuelle aide.
Juliette
c'est l'heure du déjeuner mais je me retrouve fasse à un problème qui me contraint à sauter ce repas... hihi, je sais c'est pas bien mais Excel quand tu nous tiens... lol
je vous présente mon pb.
dans l'une des multiples exquises démo de notre ami Thierry, j'ai récupérer un code me permettant notamment de renseigner dans une listbox des données obtenues grâce à une recherche effectuée dans une database txt préalablement sélectionnée...
pour les amateurs, la démo est : "Thierry's search engine v02"
(je ne me souviens plus du file)
les données souhaitées apparaisent bien dans la listbox cependant, les informations ne sont séparées que d'un espace ou un quelconque caractère.
La listbox se présente alors ainsi:
Pierre informaticien 10 ans
Frédérique pharmacienne 8 ans
Eric SP 2 mois
...
Je souhaite en fait aligner les informations sous forme de 3 colonnes.
Voici le code de Thierry:
"Private Sub CmdOKStandard()
Dim Cell As Range
Dim StringSearch As String
Dim FirstAddress As String
Dim Item
CleanStringFound
F = 0: x = 0: Total = 0
If Me.LblTXTSelected = "Selection" Or OpenFile = "" Then
Me.MultiPage1.Value = 1
Me.LblRed.Visible = True
Exit Sub
End If
With Me
StringSearch = .TxBString
If StringSearch = "" Then: .TxBString = "Cannot Be Empty": Exit Sub
End With
With USF1
.LbxString.Clear
.LblRecords = ""
.LblScan = ""
End With
With Range(RangeSearch)
Set Cell = .Find(StringSearch, LookIn:=xlValues, lookat:=xlPart)
If Not Cell Is Nothing Then
FirstAddress = Cell.Address
Do
x = x + 1
Me.LblScan = "Scanning " & x & " records"
If Me.OpbNick = True Then
On Error Resume Next
StringFound.Add Cell.Offset(0, -ColOffset).Text & "# : " & Cell.Text & " | :" & Cell.Offset(0, 1).Text, _
Cell.Offset(0, -ColOffset).Text & "# : " & Cell.Text & "| :" & Cell.Offset(0, 1).Text
Else
On Error Resume Next
StringFound.Add Cell.Offset(0, -ColOffset).Text & "# : " & Cell.Text, _
Cell.Offset(0, -ColOffset).Text & "# : " & Cell.Text
End If
DoEvents
Me.LblRecords = "Reccords " & x
Set Cell = .FindNext(Cell)
Loop While Not Cell Is Nothing And Cell.Address <> FirstAddress
End If
End With
If x = 0 Then Me.LblRecords = "No Item found": Exit Sub
For Each Item In StringFound
With USF1
.LbxString.AddItem Item
F = F + 1
End With
Next
With USF1
.LblScan = "Filtered Records " & F
End With
If F > 0 Then
With Me
.LblFineSearch.Visible = True
.TxbFineString.Visible = True
.CmdFineSearch.Visible = True
.TxbFineString.SetFocus
End With
End If
End Sub"
je n'ai pas réussi à y intégrer les notion de "ColumnCount " et de "ColumnWidths".
Merci d'avance pour votre éventuelle aide.
Juliette