Private Sub CmdSave_Click() Dim a(0 To 100) As Long Dim i As Integer For i = 0 To 100 a(i) = i Next i On Error Resume Next CdlTest.CancelError = True CdlTest.DialogTitle = "保存文件" CdlTest.FileName = "" CdlTest.Filter = "文本文件(*.txt)|*.txt" CdlTest.Flags = cdlOFNCreatePrompt + cdlOFNHideReadOnly CdlTest.ShowSave If Err = cdlCancel Then Exit Sub TextBoxSave.Text = CdlTest.FileName Open TextBoxSave For Output As #1 For i = 0 To 100 Write #1, a(i) Next i Close #1 End Sub