I am trying to clear the program window programmatically; in some cases this will help me with my interactive debugging.
The code below works fine, and I suppose that I could assign it to a function key and use it as is:
The problem is that as soon as I add a line of code which writes to the debug window AFTER the call to the above function, it stops working; ie.
works, but ...
does not. I've tried playing with the wait parameter on the Sendkeys command, but without success.
Can anyone figure?
If there's a system method to do the same thing, that would also of course suffice; though I'm really curious as to why this wont work. Even tried putting in a couple of timing delays between the lines, but all to no avail.
Any explanation would be appreciated,
Steve Lewy
Solutions Developer
steve@lewycomputing.com.au
(dont cut corners or you'll go round in circles)
The code below works fine, and I suppose that I could assign it to a function key and use it as is:
Code:
Function ClearImmediateArea()
SendKeys "^g", True 'go to the immediate window
SendKeys "^a", True 'select all content
SendKeys "{del}" 'delete it
SendKeys "{f7}" 'go back to code window
End Function
Code:
Function CallClearImmediateArea()
Debug.Print "Before"
ClearImmediateArea
End Function
Code:
Function CallClearImmediateArea()
Debug.Print "Before"
ClearImmediateArea
[red]Debug.Print "After"[/red]
End Function
Can anyone figure?
If there's a system method to do the same thing, that would also of course suffice; though I'm really curious as to why this wont work. Even tried putting in a couple of timing delays between the lines, but all to no avail.
Any explanation would be appreciated,
Steve Lewy
Solutions Developer
steve@lewycomputing.com.au
(dont cut corners or you'll go round in circles)