If I am coding with VBA in SolidWorks and I want to run a code to see how it behaves is there any way to go back to before I run the code? if I do not like the results.
There is no magic reset button. You have to start your code from some known safe state that you can get back to if your code crashes, destroys your model, crashes SW, locks your computer, etc.
Open Windows Explorer and Restore the Folder
There is an API support for grouping operations under a single or group of undo objects which you can undo with single command: 2018 SOLIDWORKS API Help - FinishRecordingUndoObject2 Method (IModelDocExtension)
Just to say that I have tried this, but it doesn't work very well. Any sketching operations are missed by the undo recording.
Retrieving data ...