# Dialog.....储存档案

Posted by 芳思 on January 22, 1999 at 11:16:53:

Private Sub cmdFile_Click()
Dim stxt As String
CommonDialog1.CancelError = True
On Error GoTo ErrHandler
stxt = "text files (*.txt)|*.txt"
CommonDialog1.Filter = stxt
CommonDialog1.FilterIndex = 1
CommonDialog1.Flags = cdlOFNHideReadOnly
CommonDialog1.FileName = "M11_FAE"
CommonDialog1.ShowSave
MsgBox CommonDialog1.FileName, , " 'save as' file...."
GoTo WriteData
ErrHandler: ' 使用者按了「取消」按钮
X = MsgBox("您确定要取消储存表单??", vbYesNo + vbCritical, "您按了取消键")
If X = True Then
Exit Sub
Else
CommonDialog1.ShowSave
End If
WriteData:
Open CommonDialog1.FileName For Output As #1
....
End Sub

这段程式码是哪里有错呢??因为我在储存档案视窗中第二次按下取消键
就会出现错误讯息..."您已按下取消键"
怎么会这样ㄋㄟ??请帮我看看吧...谢谢

Follow Ups:

- Re: Dialog.....储存档案 david 15:11:37 1/22/99 (0)
- 将 If X = True Then 改为 If X = vbYes Then Reply 13:12:55 1/22/99 (0)