Je cherche à populer un Tableau avec les nom de fichiers d'un dossier de log sans les extensions (.log) explosés en 2 colonnes

\\Serveur\dossier\
contient des logs.

01_08_statutX_NomMachine.log
02_05_statutY_NomMachine.log
...

J'ai besoin d'une macro qui popule un tableau

NomOrdinateur Statuts
machineX21 00-01-Initialisation
machineY32 02-08-déchiffrement
machineZ131 03-02-Installation
.... ....

J'ai déjà la partie du code pour chercher les nom de fichiers, mais pas pour les populer dans un tableau.
donc tout les autres étapes ont été réalisées via "record macro" et le code est "flaky" donc non optimal.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
Sub ListLogs()
Dim objFSO As Object
Dim objFolder As Object
Dim objFile As Object
Dim i As Integer
 
'Create an instance of the FileSystemObject
Set objFSO = CreateObject("Scripting.FileSystemObject")
'Get the folder object
Set objFolder = objFSO.GetFolder("\\Serveur\dossier\")
i = 1
 
'Selectionner la bonne sheet
Sheets("Buffer").Select
 
'loops through each file in the directory and prints their names and path
For Each objFile In objFolder.Files
    'print file name
    Cells(i + 1, 1) = objFile.Name
    i = i + 1
Next objFile
End Sub
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
Sub FormatData()
'
' FormatData Macro
'
    Columns("A:A").Select
    Selection.TextToColumns Destination:=Range("A1"), DataType:=xlDelimited, _
        TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=False, _
        Semicolon:=False, Comma:=False, Space:=False, Other:=True, OtherChar _
        :="_", FieldInfo:=Array(Array(1, 1), Array(2, 1), Array(3, 1), Array(4, 1)), _
        TrailingMinusNumbers:=True
    Columns("A:A").Select
    Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
    Range("A2:99").FormulaR1C1 = "=RC[1]&""-""&RC[2]&""-""&RC[3]"
 
    Range("A2:A99").Select
    Selection.Copy
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    Columns("B:D").Select
    Selection.Delete Shift:=xlToLeft
    Columns("B:B").Select
    Selection.TextToColumns Destination:=Range("B1"), DataType:=xlDelimited, _
        TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=False, _
        Semicolon:=False, Comma:=False, Space:=False, Other:=True, OtherChar _
        :=".", FieldInfo:=Array(Array(1, 1), Array(2, 1)), TrailingMinusNumbers:=True
    Columns("C:C").Select
    Selection.Delete Shift:=xlToLeft
    Columns("A:B").Select
    Columns("A:B").EntireColumn.AutoFit
    Range("B1").Select
    ActiveCell.FormulaR1C1 = "Computer"
    Range("A1").Select
    ActiveCell.FormulaR1C1 = "Status"
    Columns("A:A").Select
    Application.CutCopyMode = False
    Selection.Cut
    Columns("C:C").Select
    Selection.Insert Shift:=xlToRight
    Columns("A:B").Select
    Columns("A:B").EntireColumn.AutoFit
    Range("A1:B1").Select
    Range(Selection, Selection.End(xlDown)).Select
    ActiveSheet.ListObjects.Add(xlSrcRange, Range("$A$1:$B$99"), , xlYes).Name = _
        "T_Buffer"
    Range("T_Buffer[#All]").Select
End Sub
ceci reflète mon ancienne méthode (l'ancien nommage ne contenait pas les nombre avec soulignement que je doit maintenant re-joindre une fois explosés)