エクセルシートに.txtファイルとして保存された電子メールからコピー情報を取得しようとしています。 私が実行している問題は、ライン入力機能でDoループを使用するときです。現在の行にないテキスト行から情報を取得できません。私は、デリミネーターを含む行をコピーするコードも好きです。また、より高速なファイルの内容をループよりも一度に配列にファイルからテキスト全体を読み、そして働くことですVBAライン入力を使用する場合、下の行からテキストを取得する方法は?
intFreefile = FreeFile
Open ThisWorkbook.Path & "\temp567.txt" For Input As #intFreefile
lngRecordsInEmail = 0
Do Until EOF(intFreefile)
Line Input #intFreefile, strText
If InStr(1, strText, strDelimiter) > 0 Then
If InStrRev(1, strText, strDelimiter) = 1 Then
' if last character in line = deliminator then
' how do i get the text on 2 lines below?
Else
ws.Cells(lngRow, 1).Value = strText
End If
If blColourCell Then
ws.Cells(lngRow, 1).Interior.ColorIndex = 35
End If
strText2 = strText2 + 1
lngRow = lngRow + 1
lngTotalRecords = lngTotalRecords + 1
lngRecordsInEmail = lngRecordsInEmail + 1
End If
Loop
Close
その後、別の行を読み取るために、あなたの区切り文字を見つけた後、あなたのループ内のコードを追加する必要があります。必要に応じてループを作ります。 –