LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,059
Default Immed Win: how to home down and clear?

In a VBA macro, how can I clear the Immediate Window before doing a series
of Debug.Prints?

How can I home down or append to the bottom of the Immediate Window?

I would like this to work whether or not the Immediate Window is open.

I am using Excel 2003 on Win XP SP3.

I can do this manually, of course. But I would like the macro to do it.

In response to a similar question in Aug and Sep 2008, Bob Phillips offered:

Sub ClearImmediateWindow()
Application.SendKeys "^g ^a {DEL}"
End Sub

CharlotteE followed up (in Aug), saying that it needed to be preceded with:

Application.VBE.MainWindow.Visible = True
Application.VBE.MainWindow.SetFocus

But when I try to put that together:

1. I get an error on the first .Visible statement, namely "method VBE of
object _Application failed".

2. Without the Application.VBE statements, the .SendKeys clears the editor
pane, not the Immediate Window.

(Unless I open the Immediate Window manually and execute the macro from
the Immediate Window. Not what I want.)

With the Immediate Window closed (or open, at my discretion) and with the VB
editing pane visible, I want to put the cursor in the following macro and
press F5 to start execution.

Sub Doit()
Dim x as Double ...etc...
' clear Immediate Window here
Application.SendKeys "^g ^a {DEL}"
For i = ...
....statements includig Debug.Print...
Next i
End Sub

It might relevant to note that I have the Immediate Window in a mode where
it is "floating" (not docked?). That is, it is not the bottom pane of the
VBA window, which I think is its default position. The Immediate Window
partially overlays the VBA window when both are open.

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to close Immed Window in odd situation? [email protected] Excel Programming 0 March 15th 09 01:21 AM
Create a Clear button to clear unprotected cells Jcraig713 Excel Programming 2 November 26th 07 03:55 PM
clear the clear the web page email attachment lines MCrider Excel Discussion (Misc queries) 0 November 11th 07 10:05 PM
Home or Ctrl-Home noyb Excel Programming 7 December 6th 05 07:42 PM
Shortcut keys: CNTRL+HOME vs. HOME Paul Ofthewild Excel Discussion (Misc queries) 1 November 24th 05 09:29 PM


All times are GMT +1. The time now is 05:59 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"