VBA セルの値をテキストファイルに出力 セルの値をテキストファイルに出力 Sub test() ’ セルの値をテキストファイルに出力 Dim iNum As Integer iNum = FreeFile ’ 書き出すファイルの保存場所を””で囲む Open "D:\test\My_test.txt" For Output As #iNum Dim i As Long i = 1 Do While Sheets(1).Cells(i, 1).Value <> "" Print #iNum, Sheets(1).Cells(i, 1).Value i = i + 1 Loop Print #iNum, "************************" Print #iNum, Date ' テキストファイルを閉じる Close iNum End Sub 実行結果 ― ― ― ― ― ― ― ― ― ― → Excel VBA基礎入門もくじ へ戻る