View Single Post
  #3   Report Post  
Johan Steyn Johan Steyn is offline
Junior Member
 
Posts: 2
Default

Another solution is this:

WaitTime=30
Tyd = Timer
On Error GoTo HandleCancel 'trap errors of Cancel bug
Application.EnableCancelKey = xlErrorHandler


-------------Your main code


Exit Sub
HandleCancel:
If Err = 18 Then
If Timer - Tyd WaitTime Then
Answer = MsgBox("Cancel", vbYesNo)
If Answer = vbYes Then Exit Sub
End If
Else: MsgBox Err: Exit Sub

End If
Resume




The WaitTime is the max time your code should run. This is another option in stead of using disabling the cancel key - I just think it is a bit risky. This routine will wait 30 seconds and then re-enable the cancel/break button.