Open "f:\new.txt " For Input As #1
Dim b As String
b = StrConv(InputB(LOF(1), 1), vbUnicode)
'open 打开文件的路径 for 打开方式(这里是读取,下面的是写入和创建) as 文件号
Close #1
'以上为读取文件,以下为写入文件
Open "f:\new1.txt " For Output As #2
Print #2, b
Close #2
MsgBox "完毕 "
注释: 你把文件复制到我上面二个的地址,就可以看到效果,把你要读取的文件设置为 "f:\new.txt "或者自己改一下地址,改为你的文件地址进行读取
那你把内容写到内存流中不就可以了 SaveFileDialog 用这个保存
Public Function SaveFileFromTB(TxtBox As Object, _
FilePath As String, Optional Append As Boolean = False) _
As Boolean
`PURPOSE: Saves contents of text control (e.g., Text Box,
`Rich Text Box) specified by TxtBox to file specified by FilePath
`If Append = true, then TxtBox`s contents are
`appended to existing file contents
`else existing file is overwritten
`Returns: True if Successful, false otherwise
Dim iFile As Integer
iFile = FreeFile
If Append Then
Open FilePath For Append As #iFile
Else
Open FilePath For Output As #iFile
End If
Print #iFile, TxtBox.Text
SaveFileFromTB = True
ErrorHandler:
Close #iFile
End Function