Open FilePath For Input As #1
Do While Not EOF(1)
    Line Input #1, strData
Loop

Close #1
Open txt For Output As #1
strData = "welcome"
Print #1, strData

'换行 Chr$(13) + Chr$(10)或vbCrLf
Open txt For Append As #2 '追加

Open txt For Binary As #3
Put #3, 4, "aaa"

打开文件数量是动态的情况下,文件号可以用freefile函数来生成:

Dim FileNum As Integer
LogMessage ="Some very important text"
FileNum = FreeFile
Open FName For Append As #FileNum
Print #FileNum, LogMessage
Close #FileNum ' close the file
End Sub

 

相关文章:

  • 2021-12-15
  • 2021-11-30
  • 2021-06-16
  • 2022-01-17
  • 2022-01-16
  • 2021-12-04
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-05-28
  • 2022-01-15
  • 2022-12-23
  • 2022-12-23
  • 2021-11-05
相关资源
相似解决方案