Stepping Through (F8) Does the code suddenly execute all the code?

The macro that I wrote (on another machine) suddenly acts strange on my computer. I wrote the code in Excel 2010 and am trying to execute the code in the same.

Every time I do this, after a few lines, the rest of the code runs immediately. If I set a breakpoint, it will stop. Sometimes I can go through a few more lines before it starts auotexecutes again.

What gives? I did not find answers on the Internet ... thus, my first post on Stackoverflow.

Thanks for any tips! It makes my life difficult.

UPDATE: Now I'm back to the original programming environment, and there are no problems navigating through the code. So it must be something in my Excel settings! I canโ€™t understand that this may be possible.

+6
source share
6 answers

I found that this solution also refers to here . The solution is to make changes to the registry (taken from the source):

Changing the registry affects RPC debugging, and you can learn more about it on the Microsoft website: Debugging COM Clients and COM Servers Using RPC Debugging

1. Close Excel

2. Make a backup copy of the registry file, then open the registry - there are instructions on the Microsoft website

3. Go to the appropriate registry key:

  • For 32-bit Office, in a 64-bit window, go to the registry key: HKEY_LOCAL_MACHINE \ SOFTWARE \ Wow6432Node \ Microsoft \ VBA
  • For 32-bit Office, in a 32-bit window, go to the registry key: KEY_LOCAL_MACHINE \ SOFTWARE \ Microsoft \ VBA
  • For 64-bit Office on 64-bit Windows, go to the registry key: KEY_LOCAL_MACHINE \ SOFTWARE \ Microsoft \ VBA

4. Right-click in the window on the right and click "Create"

5.Click DWORD (in the screenshot below DWORD for 32-bit Office running on a 64-bit computer)

6. Name the DWORD as DisableOrpcDebugging7

7. Right-click DWORD and click Modify

8. Change the value to 1 and click OK.

9. The completed DWORD will appear in the registry

10. Close the registry and reopen Excel, where the F8 key should work correctly by going through the code.

+4
source

Since you mentioned that the F8 button works as expected, most of my thoughts are cleared from the table.
I can't explain this, but maybe I can provide a temporary โ€œworkaroundโ€ that I can do best. You can simulate F8 by clicking each line, and then apply CTRL + F8 (Run to cursor). The cursor will act as a breakpoint, and it is less annoying than placing / deleting breaks on each line.
This is a bit more handmade, but it goes just as fast (at least on a regular desktop). Hope this can at least reduce some of your debugging frustrations!

+1
source

FINAL UPDATE: It turns out that another application that I used in the background, called KeyRocket, and which is designed to help you remember keyboard shortcuts in office applications, was the cause of the erroneous behavior. Hope this helps someone else!

And finally, thanks to everyone for their suggestions!

+1
source

I had a similar problem, but I closed excel and saw that the EXCEL.EXE *32 process was still running, was killed, and then opened again and the macro started again. failed to override, and the macro took a step as expected.

+1
source

I had the same problem, however in Word (and not Excel) 2010.

I tried various things mentioned by other participants above, for example. closing other programs that could use the F8 key for something, and closing other MS Office 2010 applications that might interfere, but the problem was stubborn there: from a certain point in my VBA code, step-by-step code execution (F8 key) was ignored , and the whole procedure was performed immediately.

Then I did a series of experiments with my code. Thus, I discovered: in my case, the unwanted behavior appeared immediately when I called the external procedure as follows:

 Application.Run MacroName:="OneProcedureOfMine" 

To get around the problem, I rewrote the code like this:

 Call OneProcedureOfMine 

which is in any case a more elegant way. And that solved the problem. With subordinate procedures, so called, F8 gently steps through the main procedure and each procedure called inside it.

+1
source

I successfully fixed these problems by doing two things: 1. If you have several keyboard drivers loaded, uninstall the one you are not using. 2. If your keyboard has a "F Lock" key (located to the right of F12 on my keyboard), press it and try again.

0
source

Source: https://habr.com/ru/post/920941/


All Articles