By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,917 Members | 1,313 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,917 IT Pros & Developers. It's quick & easy.

Run-Time Error 2501

P: n/a
My previous message was blank so Im trying again. I have a button on a
form which opens the Import dialogue box. This works fine except if I
click on the "X" to close the form I get Run-Time Error 2501: the
DoMenuItem was Cancelled". How can I trap this error so that it doesn't
display but simply closes the form?

Thanks

Colin

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 12 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
On 06 Jan 2004 18:29:40 GMT, ColinWard <je*********@hotmail.com>
wrote:
My previous message was blank so Im trying again. I have a button on a
form which opens the Import dialogue box. This works fine except if I
click on the "X" to close the form I get Run-Time Error 2501: the
DoMenuItem was Cancelled". How can I trap this error so that it doesn't
display but simply closes the form?

Thanks

Colin


Use a standard error trap.

After the Private Sub statement, insert:
On Error GoTo PROC_ERR

Prior to the End Sub statement, insert:
PROC_EXIT:
Exit Sub
PROC_ERR:
If err.number = 2501 then
'take whatever action is appropraite
Else
'perhaps display error message
End If
Resume PROC_EXIT
Nov 12 '05 #2

P: n/a
thanks Chuck.

Thats exactly what I did and it works perfectly.

Colin

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 12 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.