' 指定されたファイルの内容をデバッグコンソールに出力する
' Trim
' Left
Public Sub ReadFile()
Dim strFilePath As String
strFilePath = ThisWorkbook.Worksheets("Sheet1").Cells(1, 2).Value
If Dir(strFilePath) = "" Then
MsgBox "指定されたファイルが存在しません" & vbCrLf & strFilePath
End If
Open strFilePath For Input As #1
Dim ws As Worksheet
Set ws = ThisWorkbook.Worksheets("Output")
Dim intRow As Integer
Dim intColumn As Integer
intRow = 1
intColumn = 1
Dim buf As String
Do Until EOF(1)
Line Input #1, buf
ws.Cells(intRow, intColumn) = buf
'Sheet1.Print buf
intRow = intRow + 1
Loop
Close #1
End Sub
' 現在時刻をOutputシートのA1セルに出力する
Public Sub OutputToCell()
Dim ws As Worksheet
Set ws = ThisWorkbook.Worksheets("Output")
Dim intRow As Integer
Dim intColumn As Integer
intRow = 1
intColumn = 1
ws.Cells(intRow, intColumn) = 1
End Sub
コメントを残す