_Application.EnableCancelKey Property
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Controls how Microsoft Excel handles CTRL+BREAK (or ESC or COMMAND+PERIOD) user interruptions to the running procedure. Read/write XlEnableCancelKey.
public:
property Microsoft::Office::Interop::Excel::XlEnableCancelKey EnableCancelKey { Microsoft::Office::Interop::Excel::XlEnableCancelKey get(); void set(Microsoft::Office::Interop::Excel::XlEnableCancelKey value); };
public Microsoft.Office.Interop.Excel.XlEnableCancelKey EnableCancelKey { get; set; }
Public Property EnableCancelKey As XlEnableCancelKey
Property Value
Remarks
XlEnableCancelKey can be one of these XlEnableCancelKey constants:
- xlDisabled Cancel key trapping is completely disabled.
- xlErrorHandler The interrupt is sent to the running procedure as an error, trappable by an error handler set up with an On Error GoTo statement. The trappable error code is 18.
- xlInterrupt The current procedure is interrupted, and the user can debug or end the procedure.
Use this property very carefully. If you use xlDisabled, there's no way to interrupt a runaway loop or other code that is not self-terminating. Likewise, if you use xlErrorHandler but your error handler always returns using the Resume statement, there's no way to stop runaway code.
The EnableCancelKey property is always reset to xlInterrupt whenever Microsoft Excel returns to the idle state and there's no code running. To trap or disable cancellation in your procedure, you must explicitly change the EnableCancelKey property every time the procedure is called.
Applies to
피드백
https://aka.ms/ContentUserFeedback
출시 예정: 2024년 내내 콘텐츠에 대한 피드백 메커니즘으로 GitHub 문제를 단계적으로 폐지하고 이를 새로운 피드백 시스템으로 바꿀 예정입니다. 자세한 내용은 다음을 참조하세요.다음에 대한 사용자 의견 제출 및 보기