Fight the Future

Java言語とJVM、そしてJavaエコシステム全般にまつわること

テキストファイルを読み込む

fiieNameはフルパスで。

Function loadTextFile(fileName As String) As String
    Dim fileNo As Integer
    Dim lineText As String
    Dim result As String
    fileNo = FreeFile
    Open fileName For Input As #fileNo
    Do While Not EOF(fileNo)
        Line Input #fileNo, lineText
        result = result & lineText & vbCrLf
    Loop
    Close #fileNo
    loadTextFile = result
End Function