Private
Sub
CommandButtonImport_Click()
Dim
fd
As
Office.FileDialog
Dim
WSh
As
Worksheet
Set
WSh = ActiveSheet
Set
fd = Application.FileDialog(msoFileDialogFilePicker)
With
fd
.Filters.Clear
.Title =
"Select a CSV File"
.Filters.Add
"CSV"
,
"*.csv"
, 1
.AllowMultiSelect =
False
Dim
sFile
As
String
If
.Show =
True
Then
sFile = .SelectedItems(1)
End
If
End
With
If
sFile <>
""
Then
Open sFile
For
Input
As
#1
row_number = 1
Do
Until
EOF(1)
Line Input #1, LineFormFile
LineItems = Split(LineFormFile,
";"
)
WSh.Cells(row_number, 1).Resize(1, UBound(LineItems) + 1) = LineItems
row_number = row_number + 1
Loop
Close #1
End
If
End
Sub