如下:
Private Sub Output_Click()
Dim filePath As String
Dim fileNo As Integer
Dim i As Integer
On Error GoTo err1
With CommonDialog1
.DialogTitle = "请输入文件名"
.Filter = "文本文档(*.txt)|*.txt"
.InitDir = App.Path
.CancelError = True
.FileName = ""
.Flags = .Flags Or cdlOFNOverwritePrompt
.ShowSave
filePath = .FileName
End With
fileNo = FreeFile
Open filePath For Output As #fileNo
For i = 1 To 6
Print #fileNo, a(i - 1) '至于你的什么变化我没看明白,变化自己写吧,输出思路是这样的
Next
Close #fileNo
err1:
End Sub
'注意,用到了一个控件, CommonDialog,你搜索就知道怎么用了
Open "输出打印.txt" For Output As #1
Write #1, a(1), a(2), a(3), a(4), a(5)
Close #1