Quit macro

User avatar
VegasNath
5StarLounger
Posts: 1185
Joined: 24 Jan 2010, 12:02
Location: Wales, UK.

Quit macro

Post by VegasNath »

How can I quit a macro that has gone into an endless loop. I am getting an input box, followed by the creation of an email which is going to cycle 65 thousand times over. I cannot get into the vbe?
:wales: Nathan :uk:
There's no place like home.....

User avatar
HansV
Administrator
Posts: 78488
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Quit macro

Post by HansV »

Try pressing Ctrl+Break (Ctrl+Pause).
Best wishes,
Hans

User avatar
VegasNath
5StarLounger
Posts: 1185
Joined: 24 Jan 2010, 12:02
Location: Wales, UK.

Re: Quit macro

Post by VegasNath »

No joy. pause and break are separate on my keyboard, combinations of each do not quit.
:wales: Nathan :uk:
There's no place like home.....

User avatar
HansV
Administrator
Posts: 78488
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Quit macro

Post by HansV »

And Esc?
Best wishes,
Hans

User avatar
VegasNath
5StarLounger
Posts: 1185
Joined: 24 Jan 2010, 12:02
Location: Wales, UK.

Re: Quit macro

Post by VegasNath »

HansV wrote:And Esc?
Esc quits the inputbox which triggers the email creation along with the next inputbox. I've really messed up here!
:wales: Nathan :uk:
There's no place like home.....

User avatar
HansV
Administrator
Posts: 78488
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Quit macro

Post by HansV »

You can use Task Manager to kill Excel...
Best wishes,
Hans

User avatar
HansV
Administrator
Posts: 78488
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Quit macro

Post by HansV »

For the future: it is useful to insert a statement

DoEvents

within a loop, at least during testing. This will allow the operating system to process events such as the user pressing Ctrl+Break.
Best wishes,
Hans

User avatar
VegasNath
5StarLounger
Posts: 1185
Joined: 24 Jan 2010, 12:02
Location: Wales, UK.

Re: Quit macro

Post by VegasNath »

Thanks Hans, another lesson well learned!
:wales: Nathan :uk:
There's no place like home.....