2017-12-20 15 views

答えて

1

これは、指定したフォルダ内のすべてのXMLファイルを見て、次にコピーします。シート1の列Aの内容:

Sub LoopThroughFiles() 
Dim MyData As String 
Dim LastRow As Long 
x = 1 
LastRow = Sheet1.Cells(Sheet1.Rows.Count, "A").End(xlUp).Row 
    Dim StrFile As String 
    StrFile = Dir("C:\Users\User3282573\*.xml") 'change this path to your folder path 
    Do While Len(StrFile) > 0 
     Open "C:\Users\User3282573\" & StrFile For Binary As #1 'also change this path 
     MyData = Space$(LOF(1)) 
     Get #1, , MyData 
     Sheet1.Cells(x, 1).Value = MyData 
     x = x + 1 
     Close #1 
     StrFile = Dir 
    Loop 
End Sub 
関連する問題