Private Sub Command1_Click()
Dim a As Integer, b As Integer
a = 0: b = 0 此处是直接给出了初值,具体的要根据实际情况二修改。
Open App.Path & "\00.txt" For Append As #1 '先创建00.txt
Print #1, "ABC"
Print #1, "DEF"
If a = 0 Then
Print #1, "GH"
End If
For a = 1 To 3 Step 1
Print #1, "IJK"
'Print #1," LM" 此处是循环,所以根据具体情况而定!下边于此情况类似!
'Print #1, "NOP"
Next a
If b = 0 Then
Print #1, "QR "
End If
For b = 1 To 2 Step 1
Print #1, "ST"
'Print #1, "UVW"
'Print #1, "XYZ"
Next b
Close #1
MsgBox ("计算完毕,请查看结果")
End Sub
结果是:ABC
DEF
GH
IJK
IJK (上边循环情况所致!)
IJK(上边循环情况所致!)
QR
ST
ST(上边循环情况所致!)
以上是我自己写的一些程序和实现结果,希望能对你有所帮助。祝你好运!
先创建个TXT文本文件
用 open语句
Dim FileNum As Integer
FileNum = FreeFile
Open InformationFile For Output As #FileNum '这就是往文本文件写入操作
Print #FileNum, Text1.Text
Close #FileNum
output