473,395 Members | 2,467 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

How to Clear the Debug Window

43
Is there any good way to use VBA to clear the Immediate Window? I found this answer but it only clears down to the current cursor position. Any way to place the cursor at the end of the window and execute this code?

Thanks!

Expand|Select|Wrap|Line Numbers
  1. Debug.Print String(256, vbCrLf)
  2.  
Oct 12 '11 #1

✓ answered by ADezii

@NeoPa:
Actually
Expand|Select|Wrap|Line Numbers
  1. DoCmd.RunCommand acCmdDebugWindow
  2.  
  3. SendKeys "^a"
  4.  
Will Select the entire contents of the Debug Window

Finalized Code:
Expand|Select|Wrap|Line Numbers
  1. Call DoCmd.RunCommand(acCmdDebugWindow)
  2. SendKeys ("^a{BS}")

9 24592
ADezii
8,834 Expert 8TB
  1. Make sure the Debug Window is Open and has the Focus
  2. Send the Cursor to the End of the Debug Window
  3. Execute your CrLfs
  4. Send the Cursor back to the ULC of the Debug Window
    Expand|Select|Wrap|Line Numbers
    1. DoCmd.RunCommand acCmdDebugWindow
    2.  
    3. SendKeys "^{END}", True
    4.  
    5. Debug.Print String(256, vbCrLf)
    6.  
    7. SendKeys "^{HOME}"
    8.  
Oct 12 '11 #2
NeoPa
32,556 Expert Mod 16PB
Nice work ADezii :-) I didn't expect that to be workable, but it was. Here's another version that deletes the text rather than scrolling it off :
Expand|Select|Wrap|Line Numbers
  1. Call DoCmd.RunCommand(acCmdDebugWindow)
  2. SendKeys("^{HOME}^+{END} {BS}")
I tried using ^A (Select entire contents) but that didn't work with SendKeys() (although it does from the keyboard of course).
Oct 12 '11 #3
ADezii
8,834 Expert 8TB
  1. Strictly out of curiosity, NeoPa, what made you think that it wouldn't work?
  2. Nice, condensed, more efficient, Version of my Code to Clear the Debug Window.
  3. Does the {BS} stand for Backspace or something different? (LOL)
Oct 12 '11 #4
ADezii
8,834 Expert 8TB
@NeoPa:
Actually
Expand|Select|Wrap|Line Numbers
  1. DoCmd.RunCommand acCmdDebugWindow
  2.  
  3. SendKeys "^a"
  4.  
Will Select the entire contents of the Debug Window

Finalized Code:
Expand|Select|Wrap|Line Numbers
  1. Call DoCmd.RunCommand(acCmdDebugWindow)
  2. SendKeys ("^a{BS}")
Oct 12 '11 #5
Sedrick
43
Thanks! I didn't know SendKeys even existed! There must be something different about Access 97 though. I can't get it to do the Control Sequences. If I do SendKeys "
Expand|Select|Wrap|Line Numbers
  1. SendKeys ("^a{BS}")
  2.  
It just puts the backspace mneumonic - "BS" - at the cursor position.

Not a problem though. My original intent was to let the user see what was printed in the window. But I recalled that I was collecting the information anyway and could just do it in a regular form.
Oct 12 '11 #6
ADezii
8,834 Expert 8TB
You must enclose BS in Braces ({...}):
Expand|Select|Wrap|Line Numbers
  1. SendKeys ("^a{BS}")
Oct 12 '11 #7
NeoPa
32,556 Expert Mod 16PB
ADezii:
Strictly out of curiosity, NeoPa, what made you think that it wouldn't work?
Interesting. When I tested with "^A", as indicated by the example in the Help, it failed. Now I've tested with "^a", your version, it works fine.

ADezii:
Nice, condensed, more efficient, Version of my Code to Clear the Debug Window.
Thank you. I appreciate praise from another experienced coder.
ADezii:
Does the {BS} stand for Backspace or something different? (LOL)
If you check the Help page though, you'll see a whole lot of special codes in braces ({}) that you can work with. I tried using "{DEL}" and that didn't seem to work either (though it should have done according to the Help page) :-(
Oct 12 '11 #8
ADezii
8,834 Expert 8TB
NeoPa:
I tried using "{DEL}" and that didn't seem to work either
Expand|Select|Wrap|Line Numbers
  1. 'Will work just as well
  2. Call DoCmd.RunCommand(acCmdDebugWindow)
  3. SendKeys ("^a{DEL}")
Oct 12 '11 #9
NeoPa
32,556 Expert Mod 16PB
Well, this is just BACKSPACE! I just tried that again exactly as you had it and, what do you know, it worked fine. It seems I just need to explain what I tested before that failed, for you to find that it works after all. It's been fun testing though :-)
Oct 13 '11 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Thomas Anderson | last post by:
I would like to replicate the debug window on a form so I can easily pass usefull info to users on long processes. Is there a simple way to do this. thanks
3
by: Mike Turco | last post by:
Is there a way to clear the debug window other than just sending a bunch of line feeds? Tanks -- Mike
7
by: Thomas Pecha | last post by:
Sorry for all who think this is easy, I was not able to handle this Coming from VB6 where with simple debug.print strAString you could write to debug window, I am totalling failing in vb.net...
1
by: Adrian Constantinescu | last post by:
Hi, When a project VB.Net start, the output window if filled with this kind on informations: 'TextBox.exe': Loaded...
11
by: Yannick Turgeon | last post by:
Hello all, I'm using A97 and W2k. We have a little problem here. Sometimes (often?), users (all co-workers) are hitting <ctrl>-G by mistake and are stucked in the debug window. I would like...
2
by: Johann Schuler | last post by:
Let's say I have a Person class with a private int age member variable. I have a get and set accessor for the Age property. When I am running the code in debug mode, I would like to have a debug...
9
by: Bob | last post by:
Does anyone know how to clear the window so it's easier to see the stuff you have listed with Debug.Write(xyz)? Bob Sweeney
2
by: Bob | last post by:
Does anyone know how to clear the window so it's easier to see the stuff you have listed with Debug.Write(xyz)? I need to know how to do this in code...I know how to manually do it with the...
1
by: JPS | last post by:
I am having trouble with this code. It is something syntactically, but I am not sure what. The first line will not compile. My ends result should clear the debug window. OutputWindow outputWin...
0
GaryTexmo
by: GaryTexmo | last post by:
Nothing amazing here, this is just a base groundwork for a debug window that someone could use to output debug text in a windows application. It provides fairly basic functionality so feel free to...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.