excelvbavbe

Stepping through code with F8 suddenly executes all code


I wrote code in an Excel 2010 environment and am trying to step through the code in the same.

After a few lines, the rest of the code is immediately executed. If I set a breakpoint it will stop. Sometimes, I can then step through a few more lines before it auotexecutes again.

I have gone back to the original programming environment and stepping through the code there is no problem.


Solution

  • I found this solution also referenced here. The solution is to make a change to the registry (taken from the source):

    The registry change affects RPC Debugging, and you can read more about it on the Microsoft website: Debugging COM Clients and Servers Using RPC Debugging

    1.Close Excel

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

    3.Go to the applicable Registry Key:

    4.Right-click in the window at the right, and click New

    5.Click DWORD (In the screen shot below, the DWORD is for 32-bit Office running on a 64-bit computer)

    6.Name the DWORD as DisableOrpcDebugging7

    7.Right-click the DWORD, and click Modify

    8.Change Value to 1, and click OK.

    9.The completed DWORD will appear in the Registry

    10.Close the Registry, and re-open Excel, where the F8 key should now work correctly, stepping through the code.