这样,Msdn中犯了一个错误.常数写错值了.
应该是ForAppending=8!!!!
你把如下的代码粘贴测试:Sub OpenTextFileTest()
Const ForReading = 1, ForWriting = 2, ForAppending = 8
Dim fs, f
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.OpenTextFile("c:\testfile.txt", ForAppending, TristateFalse)
f.Write "Hello world!"
f.Close
End SubPrivate Sub Command1_Click()
OpenTextFileTestEnd Sub注意:
要在工程中添加引用:
Microsoft Scripting Runtime
!!!!!
应该是ForAppending=8!!!!
你把如下的代码粘贴测试:Sub OpenTextFileTest()
Const ForReading = 1, ForWriting = 2, ForAppending = 8
Dim fs, f
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.OpenTextFile("c:\testfile.txt", ForAppending, TristateFalse)
f.Write "Hello world!"
f.Close
End SubPrivate Sub Command1_Click()
OpenTextFileTestEnd Sub注意:
要在工程中添加引用:
Microsoft Scripting Runtime
!!!!!
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货