Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Sub ImportFiles()
- Dim myFolder As String, myFile As String
- Dim hf As Integer: hf = FreeFile
- Dim lines() As String, i As Long, row As Integer, column As Integer
- myFolder = Application.FileDialog(msoFileDialogFolderPicker)
- With Application.FileDialog(msoFileDialogFolderPicker)
- .AllowMultiSelect = False
- .Show
- If .SelectedItems.Count > 0 Then
- myFolder = .SelectedItems(1)
- End If
- End With
- column = 0
- myFile = Dir(myFolder & "\*.txt")
- Do While myFile <> ""
- myFile = myFolder + "\" + myFile
- Open myFile For Input As #hf
- lines = Split(Input$(LOF(hf), #hf), vbNewLine)
- Close #hf
- row = 0
- For i = 0 To UBound(lines)
- MsgBox (lines(i))
- row = row + 1
- Next
- myFile = Dir
- column = column + 1
- Loop
- End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement