Excel VBA Problem With Step Into F8

After you record or write a macro in Excel, you can run the macro, or go slowly through it, line by line, to see if it is working correctly. I use the F8 key, in the Visual Basic Editor, if I’m troubleshooting a macro, to see where something is going wrong. You can use also use the Step Into command, in the VBE’s Debug menu.

f8problemfix04

However, for the past few months, something was going wrong with the “Step Into” command in Excel 2010, whether I used the menu, or the F8 key.

Code Doesn’t Stop

In some macros, especially if the code opened another Excel file, when I pressed the F8 key, the code ran to the end of the macro, instead of stopping at the next line of code. That made it very difficult to troubleshoot the code!

It could also cause other inconvenient or embarrassing problems, if the macro was designed to update files, or send out emails. You don’t want that kind of thing happening at the wrong time.

As a workaround, I could add breakpoints in the code, and it would stop there. Unfortunately, I didn’t always know when the F8 problem might occur, so I didn’t add the breakpoints in every procedure, before trying to step through it.

I searched Google, to see if anyone had a solution for the “F8 runs to the end of the macro” problem, but couldn’t find anything. There were other people complaining about the same thing, but nothing to fix the problem.

Finally a Solution Found

Finally, my friend, Ross Connell, found a solution last week, and kindly shared it with me. Ross spent a long time communicating with Microsoft’s tech support, about this and a couple of other issues, and someone there suggested this fix.

The suggestion is not documented on the Microsoft website though, so don’t take this as an official recommendation from them. However, making this change fixed the problem for me, and for Ross. If you’re comfortable in making a change to your Windows Registry, you can try it too, at your own risk.

Change the Registry

To fix this problem, you can add a new DWORD in the Registry. It’s easy to do, but as always, when working in the Registry, be careful!

I’ve outlined the steps on my website, and you can see the details here. Read the warnings carefully – you can mess things up if you aren’t careful when making a change in the Windows Registry.

On my computer, I’ve got 32-bit Office installed, on a 64-bit system, and below is a screen shot of the DWORD as I added it.

If you had the F8 problem, and tried this solution, please let me know your results, in the comments. Thanks!

f8problemfix02

________________

You may also like...

36 Responses

  1. I had a theory once. You know when you’re call stack says or something like that? My theory was that when it hit one of those, it forgot it was in step mode. ORPC = Object Remote Procedure Call, so maybe it’s ORPCs that introduce that into the call stack. Or maybe my theory is just wrong. Anyway, it’s one heck of a find by Ross.

  2. Stupid html tags. That should read …call stack says <Non-Basic Code> or something like that…

  3. Alex Losev says:

    Dear Debra !
    Many-many thanks for your advice. I had the same problem and at first I just fell into a stupor. But with help of your advice I solved the problem.
    My best wishes,
    Alex.

  4. Matt Braisted says:

    Great tip! That bug with the F8 key was giving me all sorts of trouble in a macro that I used to open a number of other files. I was just working around by constantly adding and removing code breaks. I tried your solution and it works great. Thanks you!

  5. Daniel says:

    I was not able to fix the bug on my computer. I followed scrupulously the tutorial. To no avail. May be my french version is the problem ?

    • @Daniel, Sorry it didn’t work, and I don’t know if the French version would require a different registry change.
      If you work for a company that has Microsoft support, perhaps you can make a technical support call, and see what they suggest.

  6. Daniel says:

    @ Debra, Thanks for answering. Well, no I am now a retired amateur, with no support at all. Maybe also the fact that I have every version of Excel from Excel 2003 to Excel 2013 on the same computer doesn’t help.

  7. Enkhbilguun Erdenetsogt says:

    I’m Excel 2013. It didn’t work.

    Is there any other solution for 2013? When press F8, I can hear only a beep.

  8. Joe says:

    Thank-you! The fix worked for me on 32-bit / 32-bit. This was driving me nuts!

  9. Marty Wichter says:

    I have successfully fixed these problems by doing two things:
    1. If you have more than one Keyboard driver loaded, removed 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.

  10. Daniel says:

    Great !
    It should be tested more thoroughly but step 1 seems to solve my problem.
    Thanks.

  11. Bruce says:

    Today, when I pressed the “F8” key in Excel 2013 VBA debugger, it would launch the “Find” dialog box. Yesterday the “F8” key was working fine.
    I tried this fix out of desperation, because nothing else came close to addressing the issue, and it fixed it.
    Just thought you’d like to know.

  12. Dan S says:

    The Solution worked at first, but then stopped working? I am using VBA for Excel 2013 (32 bit office, on a 64 bit OS)
    any other thoughts?

    Thanks
    Dan S

  13. Dan S says:

    p.s. this, if it works consistently, is the BEST solution so far that I have found.

  14. Bob H says:

    I have the same Office/OS as per the below:

    For 32-bit Office on 64-bit Window go to registry key:
    HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VBA

    but have no VBA folder at the end of the path above.

    Thoughts?

  15. antonio1 says:

    The best way which I tested and works great is as follow:
    open your worksheet and from vba export the sheet.cls for the sheet with the problem. Then save your excel file with a different name. Close everything and open the new file just saved with different name and import the sheet class. It is enough to delete all the content of the sheet code and to copy/paste the content of sheet class to your sheet code and everything will work fine.

    I consider this problem a bug for excel/vba

  16. Juan says:

    Don’t know if this will help anyone, but the F8 acting as a F5 keypress has happened to me today.

    I created a userform1 and to test few macro things realtime-y set the userform to ShowModal=FALSE. After this change, that, and I mean *THAT* userform1 stopped working on step-by-step debug mode^- just ran all the code to the end. Any new userform (with, obviously, ShowModal in TRUE state) worked fine, both in new sheet and in my current sheet adding a new userform2.

    It happened just after setting my userform1 to ShowModal=FALSE (to make the userform1 and Excel manageable at the same time). Returning it to the original TRUE state (can’t handle Excel while userform is shown/active) “magically” solves the problem. Excel error?

    Hope it helps.

  17. Kendz says:

    Worked for me on my Windows/Office 2013 64 bit system for a macro that was made on Windows/Office 2010 32 bit system. Thanks for the help.

  18. glnz says:

    Unfortunately, this new reg key suggestion didn’t work for this problem, and I’m having this problem in Word 2010. (I’m just learning macros for first time, so far only in Word.)

    However, it does slow down the running to the end, just a bit.

    FYI – my first test macro opens an existing docx on my hard drive, copies a paragraph, closes the docx, opens a blank new docx, pastes the paragraph and then saves the new docx with a new title on the same test folder on my hard drive. So it is reaching out to another file and making a new file, which seems to be mentioned above.

    Any other ideas? Thanks.

    • glnz says:

      Also, in the VBA sub-folder in regedit, I saw only the key Vbe7DllPath. My VBA subfolder did not have the other two keys shown above.

  19. Eileen R says:

    Another success here! Running Office 2013, Windows 7 32-bit, on a 64-bit machine. A terribly aggravating problem solved… I love you.

  20. Peter Tanner says:

    Hi Debra, Thank you so much for this wonderful tip!! It has fixed the annoying “F8 not working” or “Step Into not working” problem. For me, F8 stepping worked fine until “Application.GetOpenFilename” was called – as soon as that step finished the rest of the macro ran to the end without stopping! As I have seen others describe it, it was like the VBE forgot it was supposed to be single-stepping.
    Hopefully a big clue for others: I’m using Office 2013 32bit on a Windows 8.1 64bit PC. None of the Registry keys listed on your website existed in my registry, but searching the whole Registry for “VBA” revealed this one:
    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\15.0\ClickToRun\REGISTRY\MACHINE\Software\Wow6432Node\Microsoft\VBA
    That had just the “Vbe71DllPath” key. I added the “DisableOrpcDebugging7” key with a DWORD value set to 1, restarted Excel, and bingo! – F8 works properly now!!!
    Thanks again,
    Peter

  21. Russell Holloway says:

    Worked like a charm, took about 10 minutes to educate myself on how to access registry, backup, and actually make the change. Worked even though I forgot to close Excel first :/ Thanks double D!

  22. karthik says:

    Hi Debra.. worked like a charm! Thank you so much!!

  23. Chuck says:

    I have Office 365 32 bit on a 64 bit machine. I have Excel VBA code I wrote years ago on earlier versions of Excel. I still this code every day. And I have successfully edited that code within Excel 365. But for some reason a couple days ago I ran into this Step Into problem you describe above. Incredibly annoying that it suddenly doesn’t work.
    At any rate, I edited the registry per your instructions and it seems to have fixed the problem. Thank you for a simple and clean solution.

  1. September 8, 2014

    […] Excel VBA Problem With Step Into F8 […]

  2. November 20, 2015

    […] Try this fix: http://blog.contextures.com/archives…-step-into-f8/ […]

Leave a Reply

Your email address will not be published. Required fields are marked *