Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Stepping through macro code that is copy-pasted and executed using Run Application

This is my first time on this amazing forum. I am also very new to vba (3 weeks).

  1. I have 2 macros: CallerMac, WorkerMac. These are in separate modules within the "Modules" node of my VBAProject.

  2. In its code, CallerMac imports a .bas file (which has the WorkerMac code) and executes it through a " Application.Run"

  3. When the user is handed this code, they will run "CallerMac" (whose code wont change much) while the code imports the "WorkerMac" (likely to change often)

  4. How can I, for debugging purposes, "F8"/Step into the copied code (WorkerMac) during execution?

    Please let me know how I can rephrase my question if it doesn't say much to you or if I should have searched for it differently (I did a lot of searching before posting this code)

Many thanks.

like image 718
user2013 Avatar asked Nov 12 '22 20:11

user2013


1 Answers

You can place a breakpoint at the beginning of "WorkerMac" as you step through "CallerMac", and then use F8 to continue running "WorkerMac" in step mode.

You can add breakpoints by right clicking on a line that is an executable statement and going to Toggle->Breakpoint, or by clicking on the bar on the left next to the code. It should show a red circle in the bar and highlight the line in red.

like image 169
Ratafia Avatar answered Nov 14 '22 21:11

Ratafia