ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Avoiding macro run for terminating by user (https://www.excelbanter.com/excel-programming/342321-avoiding-macro-run-terminating-user.html)

escelinen

Avoiding macro run for terminating by user
 

Hello,

is it possible to avoid user to terminate macro? If I have quit long
macro running, which is processing several actions in many sheets, I
don't want anybody to terminate macro by pressing *Ctrl-Break*. If that
happens, it would be catastrophic for my workbook to run correctly next
time somebody wants run a macro again. :eek:


--
escelinen
------------------------------------------------------------------------
escelinen's Profile: http://www.excelforum.com/member.php...o&userid=27966
View this thread: http://www.excelforum.com/showthread...hreadid=474662


Gary Keramidas

Avoiding macro run for terminating by user
 
maybe something like this

' Macro to turn off keyboard entry.
Sub KeyboardOff()
' Sets CTRL+D to activate KeyboardOn.
Application.OnKey "^d", "KeyboardOn"
Application.DataEntryMode = True
End Sub

' Macro to restore keyboard entry.
Sub KeyboardOn()
Application.DataEntryMode = False
End Sub

here's the kb article

http://support.microsoft.com/default...b;en-us;213509

--


Gary


"escelinen" wrote
in message ...

Hello,

is it possible to avoid user to terminate macro? If I have quit long
macro running, which is processing several actions in many sheets, I
don't want anybody to terminate macro by pressing *Ctrl-Break*. If that
happens, it would be catastrophic for my workbook to run correctly next
time somebody wants run a macro again. :eek:


--
escelinen
------------------------------------------------------------------------
escelinen's Profile:
http://www.excelforum.com/member.php...o&userid=27966
View this thread: http://www.excelforum.com/showthread...hreadid=474662




Norman Jones

Avoiding macro run for terminating by user
 
Hi Escelinen,

See the EnableCancelKey property in VBA help.

For example:

Application.EnableCancelKey = xlDisabled


---
Regards,
Norman



"escelinen" wrote
in message ...

Hello,

is it possible to avoid user to terminate macro? If I have quit long
macro running, which is processing several actions in many sheets, I
don't want anybody to terminate macro by pressing *Ctrl-Break*. If that
happens, it would be catastrophic for my workbook to run correctly next
time somebody wants run a macro again. :eek:


--
escelinen
------------------------------------------------------------------------
escelinen's Profile:
http://www.excelforum.com/member.php...o&userid=27966
View this thread: http://www.excelforum.com/showthread...hreadid=474662





All times are GMT +1. The time now is 12:19 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com