投稿日 | : 2003/03/24(Mon) 10:39 |
投稿者 | : 花ちゃん |
Eメール | : |
URL | : |
タイトル | : Re: ありがとうございます。追加の質問ですが。 |
以下を試して見て下さい。
又ここの FileSystemObject関係の FileSystemObject オブジェクトについて の
TextStream オブジェクトのプロパティの一覧を見て下さい。
Private Sub Command1_Click()
'ファイルをオープンし一行ずつ読込んでテキストボックスに表示
Dim Fso As New FileSystemObject
Dim FsoFile As TextStream
Dim myText As String
Set FsoFile = Fso.OpenTextFile("Test.Txt")
'ファイルのポインタがファイルの末尾の位置にある場合は(True)を返し
'それ以外の場合は(False)を返します。
With FsoFile
Do Until .AtEndOfStream
Select Case .Line
Case 1, 3, 7, 9
myText = myText & .ReadLine & vbNewLine
Case Else
.SkipLine
End Select
Loop
End With
FsoFile.Close
Text1.Text = myText
End Sub