Reset VBA Code

JerryD

New Member
Joined
Dec 23, 2005
Messages
21
When I execute a macro, and if during the macro execution I press the "Esc" key, the execution stops and I get a Microsoft Visual Basic window with the message that code execution has been interrupted with buttons to Continue, End, Debug and Help. If I click the "End" button, the window closes and Excel is at rest - which seems to be some sort of Reset process.

I have a need to execute that process while Excel is at rest.
Is there any way to code the process in VBA?

TIA

JerryD
 

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
Jerry

What exactly do you mean?

What 'Reset' process are you referring to and what are you trying to achieve?
 
Upvote 0
Norie:

When I execute a macro of mine, it slows down each succeeding time I execute it until it gets real slow. I don't know exactly what is happening but somehwere in the past, I recall that Excel uses up resources which it does not return for use. Maybe that is what's happening.

In my case, when I interrupt this macro with "Esc" and get the interrupt window and click the "End" button, the macro will then execute at it's most fast speed again (until I run it a few times). I also get this desired result by pressing "Esc" and the clicking "Debug" which sends me to the VBA editor with the "Yellow" line which forces me to Run/Reset. (Also, exiting Excel and coming back in will allow the macro to run at it's most fast speed)

I would like to be able to execute whatever this reset is without having to inturrupt with "Esc" and clicking "End". Right now, if the macro gets too slow, I just periodically press "Esc" during execution and Click "End".
Then rerun the macro. If I could code that process, I might be able to execute it on the fly to prevent the slow down to begin with.

Whatcha think?


JerryD
 
Upvote 0
Jerry

I think it would be useful to see your code.

Perhaps we could take a look at it and see why it's slowing down.

PS I don't think this 'Reset' actually exists, could be wrong though.:)
 
Upvote 0
Sorry, I can't send the code. But the macro works fine and does all it's supposed to do. It just slows down with continued use.

But I can further describe the reset process I am speaking about (I am using Excel2000). Do you personally have a macro which requires enough seconds to execute that you could press the "Esc" key before the execution is finished? If so, execute it and press the "Esc" key before it is finished. I know that there is some code which may not halt with the "Esc" key but mine does. When it stops (interrupted), the window that is displayed has 4 buttons for selection. I click the "End" button and the interrupt window closes. (I have interrupted the macro and stopped the process)

Also, instead of clicking the "End" button, I can click "Debug" and the VBA editor is opened (and in my case, a line in the macro is yellowed out). If I then click "Run" in the menu bar and click the "Reset" selection in the drop down "Run" menu, it will also close the interrupt window and also apparently "resets" whatever it is that is slowing down my macro. Since I am selelcting "Reset" as a command in the "Run" Menu, that is why I am calling it a reset condition.

It may not be a reset but maybe just a termination process. But it is that process which I would like to code if possible.

Excel suspends code execution if you really have an execution error and forces you to go to the VBA editor and do the Run/Reset command "and a code correction". I don't have a code error but I would like to do that Run/Reset anyway, at my convenience, to eliminate my slow down problem.

JerryD
 
Upvote 0
Jerry

If you can't post the code I can't really see how we can help.:)

Could you not even outline what the code is doing?

As far as I know Reset just stops execution.
 
Upvote 0
Jerry,

Any number of code contructs could lead to your code "slowing down" and I am almost certain that that the VBA editor has nothing to do with it. It is not necessary to "send" your code anywhere. You can simply copy and paste the code into your post. (providing you surround it with code tags. If necessary you can post a representative sample of your code, or replace any proprietary information.

Norie is one of the best code people we have here, but without some code, there is nothing that can be done.
 
Upvote 0
OK. I appreciate your replies. I guess it must be a communications thing. My macro code really has nothing do do with my inquiry. I only used the macro and what I was experiencing, as an example to show or explain what I would like do.

So, just assume I had not mentioned my macro at all, or what it was doing. Now, is there any way to code the following procedure: (I would like to be able to execute the following steps, preferrably with a macro rather than having to do the steps manually).

From Excel:
1. Click Tools
2. Point at Macro
3. Click Visual Basic Editor
4. In the VBA Editor menus, Click the Run menu
5. In the drop-down, Click the Reset command
6. Return to Excel

Or, any other macro execution which would "do what steps 1-6 do". Turning the Macro Recorder ON does not record anything when I do those steps. And, if you just do steps 1-6, it appears that you have done nothing. However, I can assure you, something in Excel gets reset because when I manually do those steps, Excel makes a "distinct" change (I can see it in the execution time of my macro).

Microsoft would not have the VBA Run/Reset command in the menu if it didn't do something. It may not be possible to code it but Excel recognizes when you click Reset. That's all I'm asking. Is it possible to execute that Reset with code (or anything else equivalent in code) rather than having to manually click thru the steps?

Thanks for your help.

JerryD
 
Upvote 0
Jerry

Of course it does something, and as far as I'm aware it just stops code execution.:)
 
Upvote 0
As well as stopping code execution a Reset will also reset all public variables. This can also be achieved through an End (not End Sub etc.) statement.

However I'm still curious as to why your macros would slow down and why you feel unable to post the code :confused:
 
Upvote 0

Forum statistics

Threads
1,213,536
Messages
6,114,208
Members
448,554
Latest member
Gleisner2

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top