例ではCSVファイルを1行ずつ読み込み、Excelのシートに挿入していく。
データは「”」で囲われているため、ダブルクォーテーション削除処理が必要になる。
ソース
Dim Row
Dim ImportFile
Open ImportFile For Input As #1
Row = 11
'読み込む
Do While Not EOF(1)
'1行読込
Line Input #1, LineStr
LineArray = Split(LineStr, ",")
'タイトル
ActiveWorkbook.Sheets(1).Cells(Row, 1).Value = "・" & ダブルクォーテーション削除(LineArray(4))
'開始予定日?終了予定日
ActiveWorkbook.Sheets(1).Cells(Row, 2).Value = Format(LineArray(6), "mm/dd") & "?" & Format(LineArray(7), "mm/dd")
'開始日?終了日
ActiveWorkbook.Sheets(1).Cells(Row, 3).Value = Format(LineArray(8), "mm/dd") & "?" & Format(LineArray(9), "mm/dd")
Row = Row + 1
Loop
Close #1