不知道是不是这个问题: 少了一个条件 If CommonDialog1.FileName = "" Then Exit SubPrivate Sub Command1_Click() CommonDialog1.ShowOpen If CommonDialog1.FileName = "" Then Exit Sub ''Do the things you want End Sub
也可以这样: On Error Goto ExitLine Commondialog1.CancelError = True ...ExitLine: Exit Sub
少了一个条件 If CommonDialog1.FileName = "" Then Exit SubPrivate Sub Command1_Click()
CommonDialog1.ShowOpen
If CommonDialog1.FileName = "" Then Exit Sub
''Do the things you want
End Sub
On Error Goto ExitLine
Commondialog1.CancelError = True ...ExitLine:
Exit Sub