Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Is there a way in VBA to clear the Immediate Window?

Status
Not open for further replies.

Soundsmith

Programmer
Feb 21, 2001
84
US
I'm running tests on some complex updates, and trying to trace the progress is very cumbersome. I'd like to have the immediate window display the order the subs and functions execute. To do this, I've added this at the top of each procedure:

Code:
If isTesting Then
    Debug.Print "myProcName"
End If

I'd like to have the open procedure also clear the Immediate window, to reset the display. Any way to do this?
Thanks. David 'Dasher' Kempton
The Soundsmith
 
No. The best way to clear the immediate window is to bring it up;Ctrl-G Press Ctrl-A to select All or place the cursor before the first entry, hold the shift-key and press Ctrl_end to select all the data. Then press Delete.

mac
 
Mac, the whole point is to avoid doing exactly that. I don't want to have to go those those steps every time I run a code fragment, but I need to know what events are being triggered and re-triggered.

Perhaps I could do this with a SendKeys routine? I'm going to give that a try.

David David 'Dasher' Kempton
The Soundsmith
 
David, according to my references, it can't be accomplished with code. Good luck.

mac
 
Mac: you're right. A SendKeys(CHR(7)) selects the immediate window, and a sendkeys(CHR(1)) selects all, but the program now waits for something to do... the Cut is ignored (CHR(24) and I'm not sure how to try a DELETE key.

But I'm not going to worry about it. THanks for your help.

David K David 'Dasher' Kempton
The Soundsmith
 
A better approach is to use an array (or recordset) to gather your info. I include a "trace" for which allows me to set several parameters, including the "Clear History" which you allude to. I also include the date/time of each occurance, as well as selcted variable values. I agree that you need flexability in trace level debugguing - I just don't think that the immediate window is the place to expect the sophistication / flexability.

MichaelRed
m.red@att.net

There is never time to do it right but there is always time to do it over
 
Michael, you're right, adn that's a good idea-I was just trying to get a QAD view into the order of events being called, so my code could minimize the trace convolution.

But I'll try it your way (it IS a better solution!) Thanks.

David K David 'Dasher' Kempton
The Soundsmith
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top