Clear the Immediate Window.

  • Thread starter tcarnahan via AccessMonster.com
  • Start date
T

tcarnahan via AccessMonster.com

I recently been using the VBA Extensibility DLL to run some useful routines
that help me troubleshoot code. I would like to be able to programmatically
clear the "Immediate Window" but have not had any success. I tried using some
SendKeys routines, but that was not reliable (sometimes it overwrote my code).


Does anyone know how to programmatically clear the "Immediate Window" ?
 
D

Dirk Goldgar

tcarnahan via AccessMonster.com said:
I recently been using the VBA Extensibility DLL to run some useful routines
that help me troubleshoot code. I would like to be able to
programmatically
clear the "Immediate Window" but have not had any success. I tried using
some
SendKeys routines, but that was not reliable (sometimes it overwrote my
code).


Does anyone know how to programmatically clear the "Immediate Window" ?


I could be mistaken, but I remember this being discussed before and the
consensus being arrived at that the simplest way to clear it is to write a
bunch of empty lines to it, along the lines of

Dim i As Integer

For i = 1 To 255
Debug.Print
Next i

The only trouble with that is that it leaves the caret positioned at the
bottom of the window, not the top.
 
T

tcarnahan via AccessMonster.com

Thanks for the idea, Dirk!


At one time, I had a procedure that I think worked. I would use the SENDKEYS
function to access the Immediate Window (SENDKEYS "^G"), the other SENDKEYS
to manipulate the menu. If I recall, one had to be careful to let it run to
completion because if you didn't and the focus was taken off the Immediate
Window, it could wipe out your code. However, when I tried to duplicate it
from memory, did not run. Unfortunately, I can't find a copy of my old code.

Does anyone else know of a way to do this?

------------------------------------------------------------------------------
------

Dirk said:
I recently been using the VBA Extensibility DLL to run some useful routines
that help me troubleshoot code. I would like to be able to
[quoted text clipped - 5 lines]
Does anyone know how to programmatically clear the "Immediate Window" ?

I could be mistaken, but I remember this being discussed before and the
consensus being arrived at that the simplest way to clear it is to write a
bunch of empty lines to it, along the lines of

Dim i As Integer

For i = 1 To 255
Debug.Print
Next i

The only trouble with that is that it leaves the caret positioned at the
bottom of the window, not the top.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top