1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
|
Private Sub UserForm_Initialize()
ListBox_Cons.Clear
EcranConsult.ListBox_Cons.ColumnCount = 4
repertoire = ActiveWorkbook.Path & "\Stockage"
Dim Coll_Docs As New Collection
Dim Search_path, Search_Filter, Search_Fullname As String
Dim DocName As String
Dim i As Long
Search_path = repertoire
Search_Filter = "*.txt"
Set Coll_Docs = Nothing
DocName = Dir(Search_path & "\" & Search_Filter)
Do Until DocName = ""
Coll_Docs.Add Item:=DocName
DocName = Dir
Loop
For i = Coll_Docs.Count To 1 Step -1 '
Xpn = InStr(1, Coll_Docs(i), ",")
Xlabel = InStr(Xpn + 1, Coll_Docs(i), ",")
XQty = InStr(Xlabel + 1, Coll_Docs(i), ",")
XLoc = Len(Coll_Docs(i)) - 4
EcranConsult.ListBox_Cons.AddItem 'Coll_Docs(i)
EcranConsult.ListBox_Cons.List(ListBox_Cons.ListCount - 1, 0) = Left(Coll_Docs(i), Xpn - 1)
EcranConsult.ListBox_Cons.List(ListBox_Cons.ListCount - 1, 1) = Right(Left(Coll_Docs(i), Xlabel - 1), Xlabel - (Xpn + 1))
EcranConsult.ListBox_Cons.List(ListBox_Cons.ListCount - 1, 2) = Right(Left(Coll_Docs(i), XQty - 1), XQty - (Xlabel + 1))
EcranConsult.ListBox_Cons.List(ListBox_Cons.ListCount - 1, 3) = Right(Left(Coll_Docs(i), XLoc), XLoc - XQty)
Next i
TBlBD = ListBox_Cons.List
End Sub
Private Sub TextBox_PNS_Change()
ColRechTextbox = 0
Dim b()
If Me.TextBox_PNS <> "" Then
Set d1 = CreateObject("Scripting.Dictionary")
tmp = Me.TextBox_PNS & "*"
n = 0
For i = 0 To UBound(TBlBD)
If TBlBD(i, ColRechTextbox) Like tmp Then
n = n + 1: ReDim Preserve b(0 To UBound(TBlBD, 2), 1 To n)
For k = 0 To UBound(TBlBD, 2): b(k, n) = TBlBD(i, k): Next k
End If
Next i
If n > 0 Then Me.ListBox_Cons.Column = b Else Me.ListBox_Cons.Clear
Else
Me.ListBox_Cons.List = TBlBD
End If
End Sub |
Partager