View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
RayportingMonkey RayportingMonkey is offline
external usenet poster
 
Posts: 87
Default Use VBA to Enter Break-Mode?

Thanks - and yes, using code like:

If Dir("\\NetworkShare\Pause.Excel") < "" Then
MsgBox "You wanted to get my attention?"
Kill ("\\NetworkShare\Pause.Excel")
End If

would throw a message box, thus interrupting code execution. Now maybe this
is just me getting stuck on a particular train of thought, but I want the
"event", be it a watch or be it with code like the above to actually enter
break-mode.

Again, I can do it with a watch, but I can't figure out how to script an
on-open event that would Add my Watch criteria.

Further, I can use code like in my example, but couldn't figure out how to
throw the Ctrl-Break. I tried code like this, but it didn't do what I
expected (stop the code as if Ctrl-Break was pressed on the keyboard).

If Dir("\\NetworkShare\Pause.Excel") < "" Then
SendKeys ("^{BREAK}")
Kill ("\\NetworkShare\Pause.Excel")
End If

I also tried removing the () like this: SendKeys "^{BREAK}" to no avail...

Again, I appreciate the assistance.

--
"Trying to make reports so easy... even a monkey could run ''em!"


"Dick Kusleika" wrote:

On Wed, 23 Jul 2008 11:26:01 -0700, RayportingMonkey
wrote:

I played with setting up a watch that breaks the script if a file named
pause.excel appears at a specific location - this did allow me to force the
code to enter break mode on a remote computer by creating the file
pause.excel from my laptop.


That's pretty clever.

You might sprinkle some DoEvents lines in your code, particularly in loops.
This will allow commands in the Windows stack to execute and may be enough
to give you access and allow Control-Break to work.
--
Dick