ON ERROR RESUME NEXT
D.S.,
Could it be that there is "active" error handler in a calling procedure? Read VBA Help on On Error, it might give you some clues.
Regards,
Anders Silven
-------------------------
"D.S." skrev i meddelandet ...
Yep, works for me to if I run this as a separate procedure, but when this code is within another procedure, it hangs on me every time.
D.S
"Anders S" wrote in message ...
The following code works for me. Nothing changed, just added a MsgBox.
Sub test354()
Dim dteDate As Date
On Error Resume Next 'turn on error handling
dteDate = CDate(InputBox("Enter ending date for projection", Default:=Date))
If Err.Number 0 Then 'trap error if user clicks the cancel button
Exit Sub
End If
On Error GoTo 0 'reinstate normal error procedures
MsgBox "Date OK"
End Sub
Regards
Anders Silven
'---------------------------
"D.S." skrev i meddelandet ...
First post not showing up on board, will try posting again.
Error handling will not work if input box "Cancel" button is selected. I will get an error message, error #13, < Type Mismatch . What's going on here?
dim dteDate as Date
On Error Resume Next 'turn on error handling
dteDate = CDate(InputBox("Enter ending date for projection", Default:=Date))
If Err.Number 0 Then 'trap error if user clicks the cancel button
Exit Sub
End If
On Error GoTo 0 'reinstate normal error procedures
D.S.
|