Possible? Use VBA & Copy / Clear contents of VBA Immediate Window to .txt file

Cosmos75

Registered User.
Local time
Yesterday, 21:11
Joined
Apr 22, 2002
Messages
1,281
Firstly, is there a way to copy the contents of the VBA Immediate Window to a .txt file using VBA? This one doesn't sound possible to me but I thought I'd ask.

I did find this.

Secondly, is there a way to clear the contents of the VBA Immediate Window using VBA?

Just FYI, I ran this code to see how many lines I could get in the immediate window.
Code:
For i = 500 To 1 Step -1
    Debug.Print i  & " zzzzzzzzzzzzzz"  'I used more Zs' than this
Next i
I got 199 lines. Guess that is the limit.
 
WayneRyan,

Thank you for that link!
:)

Since it uses "keystrokes" to delete the contents of the immediate window;
Code:
[COLOR=DarkGreen]'Send CTRL+A (select all) and Delete keystokes[/COLOR]
PostMessage hChild, WM_KEYDOWN, vbKeyA, 0&
PostMessage hChild, WM_KEYDOWN, vbKeyDelete, 0&
Perhaps it is possible to copy the contents to "Notepad" or even a memo field? Though I'll have to figure out how! :eek:

When I have time I will give it a try and post back if I figure it out.
 

Users who are viewing this thread

Back
Top Bottom