An implementation of Visual Basic that is built into Microsoft products.
Hi Joel O,
Thank you for noting that Undo restores the code, as that helps distinguish a source-code edit from an actual VBA project reset.
The message “This action will reset your project, proceed anyway?” can appear when VBA is in Break mode and a code change has been made that prevents execution from continuing. Resetting the project stops the current execution; it should not normally delete the source code from the module.
Since all of the code is already selected before you click OK, and Undo restores it afterward, the deletion may be related to the editor/input action occurring at that point rather than the reset itself.
Before testing further, I recommend making a backup of the file and exporting the affected module if possible.
Then please try the following:
- In the VBA editor, select Run > Reset (or use the square Reset/Stop button).
- Select Debug > Compile VBAProject and check whether a compilation error appears.
- Save the file, close the host application completely, reopen it, and try running the procedure again.
- Try Run > Run Sub/UserForm from the VBA menu instead of using the keyboard shortcut.
- If the issue occurs only in this module, export it as a backup, create a new standard module, copy the code into it, and test again.
- If you're using Excel, also test whether the same behavior occurs in a new macro-enabled workbook with a simple macro.
If the issue persists, could you please provide:
- The Office application and exact version you are using
- The exact mouse/keyboard actions immediately before the prompt appears
- Whether [break] appears in the VBA editor title bar
- Whether the same issue occurs in a new file with a simple test macro
- A screenshot of the VBA editor immediately before clicking OK, with any sensitive information removed
These details should help narrow down whether the behavior is associated with the current debugging state or with the editor/input action occurring when the code becomes selected.
If you found my response helpful or informative, I would greatly appreciate it if you could follow this guide for your confirmation. Thank you.