Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 87
Default Use VBA to Enter Break-Mode?

I run a lot of code on a remote computer. The problem is that sometimes the
code hangs up, or the job runs longer than anticipated and I need to break
the code. unfortunately, sometimes I can't even remote into the machine or
Ctrl-Break isn't recognized.

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.

I haven't played with the watch feature until now so to test it I savd the
file, launched from another computer and looked at the watch, but it was
empty.

Is there VBA that I can put in the On-open statement that would Add my
critera for a Watch?

Or is there another way to force Excel into break-mode from a remote computer?
--
"Trying to make reports so easy... even a monkey could run ''em!"
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 396
Default Use VBA to Enter Break-Mode?

Hello

You could have a look at the EnableCancelKey Property in the helpfiles.

--
Wigi
http://www.wimgielis.be = Excel/VBA, soccer and music


"RayportingMonkey" wrote:

I run a lot of code on a remote computer. The problem is that sometimes the
code hangs up, or the job runs longer than anticipated and I need to break
the code. unfortunately, sometimes I can't even remote into the machine or
Ctrl-Break isn't recognized.

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.

I haven't played with the watch feature until now so to test it I savd the
file, launched from another computer and looked at the watch, but it was
empty.

Is there VBA that I can put in the On-open statement that would Add my
critera for a Watch?

Or is there another way to force Excel into break-mode from a remote computer?
--
"Trying to make reports so easy... even a monkey could run ''em!"

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 87
Default Use VBA to Enter Break-Mode?

I actually did check that out first. But considering that there are times I
can't get control of the machine that is running the code, depressing any
key(s) seems to be a moot point.

Again, with the Watch feature, I was at least able to place a file on a
shared drive which forced the code into break-mode, enabling me to get
control of the machine.

I apprecaite the response though...

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


"Wigi" wrote:

Hello

You could have a look at the EnableCancelKey Property in the helpfiles.

--
Wigi
http://www.wimgielis.be = Excel/VBA, soccer and music


"RayportingMonkey" wrote:

I run a lot of code on a remote computer. The problem is that sometimes the
code hangs up, or the job runs longer than anticipated and I need to break
the code. unfortunately, sometimes I can't even remote into the machine or
Ctrl-Break isn't recognized.

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.

I haven't played with the watch feature until now so to test it I savd the
file, launched from another computer and looked at the watch, but it was
empty.

Is there VBA that I can put in the On-open statement that would Add my
critera for a Watch?

Or is there another way to force Excel into break-mode from a remote computer?
--
"Trying to make reports so easy... even a monkey could run ''em!"

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 595
Default Use VBA to Enter Break-Mode?

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
  #5   Report Post  
Posted to microsoft.public.excel.programming
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



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 595
Default Use VBA to Enter Break-Mode?

On Thu, 24 Jul 2008 06:04:00 -0700, RayportingMonkey
wrote:

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...


I don't think you can program in a watch statement. I should have mentioned
that in my first reply, but I was busy getting ahead of myself.

To throw the equivalent of Ctl+Break, use Stop

If Condition Then
Stop
End if

But, of course, that's not like a watch because it only works when that If
block executes, whereas a watch would break at any time the condition is
met.
--
Dick Kusleika
Microsoft MVP-Excel
http://www.dailydoseofexcel.com
  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 87
Default Use VBA to Enter Break-Mode?

Dick - I figured I was missing something simple like that!

Just for the sake of the thread, this is how I implimented the change:

If Dir("\\NetworkShare\Pause.Excel") < "" Then
Kill ("\\NetworkShare\Pause.Excel")
Stop
End If

I had to put the Stop AFTER the Kill statement, so that the Pause.Excel file
gets removed, fostering a 1-Time Event.

Again, thanks!
Ray

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


"Dick Kusleika" wrote:

On Thu, 24 Jul 2008 06:04:00 -0700, RayportingMonkey
wrote:

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...


I don't think you can program in a watch statement. I should have mentioned
that in my first reply, but I was busy getting ahead of myself.

To throw the equivalent of Ctl+Break, use Stop

If Condition Then
Stop
End if

But, of course, that's not like a watch because it only works when that If
block executes, whereas a watch would break at any time the condition is
met.
--
Dick Kusleika
Microsoft MVP-Excel
http://www.dailydoseofexcel.com

Reply
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
Can't enter break mode at this time ERROR Ayo Excel Discussion (Misc queries) 4 July 21st 08 05:09 PM
can't enter break mode at this time DanR Excel Programming 7 May 7th 07 02:53 PM
Can't enter break mode at this time CWillis Excel Discussion (Misc queries) 2 June 1st 06 07:43 PM
Can't enter break mode eugene Excel Programming 0 May 11th 06 09:21 PM
received message: Can't enter break mode at this time William Weder Excel Programming 0 March 1st 06 01:58 AM


All times are GMT +1. The time now is 10:39 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"