VBA Line by line !!!

ECEK

Registered User.
Local time
Today, 08:22
Joined
Dec 19, 2012
Messages
717
I have my OnTimer events

These are mainly queries.

What is the shortcut in vba to run each line of code within VBA?
 
It depends on what you want to do.
Probably F8 for Step Into...
Have a look at the choices in the VBE Debug window

NOTE I'm not clear why you referred to the On Timer events
 
I read that ontimer could cause an issue. I included it just in case.
I have tried selecting the beginning, end whole of the line of text and pressed F8....nothing
I have tried a blank line and pressed ctrl F8 (expecting the code to run upto the point of the curser....nothing other than a message to say that that "Line is not an executable statement"

what I'm looking to do is (for example) run the queries from the code as opposed to reading the code and manually running them.
 
Put a breakpoint into your code (Click in the border to the left of your code and you'll get a big brown/reddy coloured blob.)

Execute your code normally and it will stop on the blob, then press F8 to step through it.
 
How do I execute the code?
I'm being awfully dumb here....please bear with me !
 
Run the code as you would normally do e.g. by clicking a button etc
 
I think it's F5 to start code, F8 to step through. Not only does this sometimes depend on your pc/laptop (I must use fn+F8 keys) whether or not it works depends on factors I've never bothered to figure out. That is, sometimes a Run Macro dialog pops up.
In addition, if it's a procedure that requires parameters, simply pressing F5 won't work. Approach would be to call the procedure by typing its name and the parameters in the immediate window after putting a break point in the code. If you continue to have issues, maybe post the code so we can see what's involved.
 
you mention the ontimer event - a form event.

you can only start running code using ctrl-F8/F5 in a standard module - and that in a function or sub which does not have parameters.

In a class module (i.e. a form module) you need to start the code on a form/control event, use a breakpoint to pause the code, then F8/F5 to step through/continue.
 
you can only start running code using ctrl-F8/F5 in a standard module - and that in a function or sub which does not have parameters.

In a class module (i.e. a form module) you need to start the code on a form/control event, use a breakpoint to pause the code, then F8/F5 to step through/continue.

I click the little green arrow button to Start. It is in the Standard Toolbar.

Step In Step Out, Step Over are also available.

Comment Block and Uncomment Block are really useful too.

All toolbars can be fully customised.
 

Users who are viewing this thread

Back
Top Bottom