|
▼aki さん:
こんにちは。
「FileSystemObject」を使用した例です。
Sub セミコロン区切り取込()
Dim FSO As Object
Dim rFile As Object
Dim rName As String
Dim rLine As String
Dim rTxt As Variant
Dim Kiten As Range '基点にしたいセル
Dim y As Long
Dim x As Long
rName = "C:\test2.txt"
Set Kiten = ActiveSheet.Range("C5")
Set FSO = CreateObject("Scripting.FileSystemObject")
Set rFile = FSO.OpenTextFile(rName)
y = 0
Do Until rFile.AtEndofStream
rLine = rFile.ReadLine
rTxt = Split(rLine, ";")
For x = 0 To UBound(rTxt)
Kiten.Offset(y, x).Value = rTxt(x)
Next
y = y + 1
Loop
rFile.Close: Set rFile = Nothing
Set FSO = Nothing
Set Kiten = Nothing
End Sub
外していたらすみません。
|
|