PC Review


Reply
Thread Tools Rate Thread

Code stops for no reason (that I can think of)

 
 
Daniel Bonallack
Guest
Posts: n/a
 
      17th Jun 2009
I built a short and simple procedure on my PC, tested it, converted it to an
xla, and made a button. I installed this button on a couple of colleagues'
PCs.

On only one PC, when the button is pressed, about a third of the macro runs,
then the debug window shows, saying the code has been interrupted (as if I
had pressed "Ctrl+Break"). If I hit "Continue", it then happily runs the
rest of the code as if no problem ever existed.

Do you know why, on one PC, Excel is acting as if I had pressed "Ctrl +
Break"?

thanks in advance
Daniel
 
Reply With Quote
 
 
 
 
Rick Rothstein
Guest
Posts: n/a
 
      17th Jun 2009
I think we will need to see your code (in order to see exactly what you are
doing) before being able to make a guess as to what is going on. If you do
post your code, indicate the line it is stopping on (just in case we can't
duplicate your results on our systems).

--
Rick (MVP - Excel)


"Daniel Bonallack" <(E-Mail Removed)> wrote in
message news:8F60D92A-55DD-4B65-97D5-(E-Mail Removed)...
>I built a short and simple procedure on my PC, tested it, converted it to
>an
> xla, and made a button. I installed this button on a couple of
> colleagues'
> PCs.
>
> On only one PC, when the button is pressed, about a third of the macro
> runs,
> then the debug window shows, saying the code has been interrupted (as if I
> had pressed "Ctrl+Break"). If I hit "Continue", it then happily runs the
> rest of the code as if no problem ever existed.
>
> Do you know why, on one PC, Excel is acting as if I had pressed "Ctrl +
> Break"?
>
> thanks in advance
> Daniel


 
Reply With Quote
 
Bob Umlas
Guest
Posts: n/a
 
      17th Jun 2009
Vista, Excel 2007, right? We've encountered this and have not yet found a
workaround. Instructions to our users is to just click continue. Still
trying to set it up so it happens consistently so we can report to
Microsoft, but so far it seems pretty random, although with a particular
application it happens very frequently. There's NO reason this should
occur -- I pretty much know what I'm doing and for it to say code execution
has been interrupted on a statement like End Sub is ridiculous!!
I'm afraid you're going to have to just live with it!
Bob Umlas
Excel MVP

"Daniel Bonallack" <(E-Mail Removed)> wrote in
message news:8F60D92A-55DD-4B65-97D5-(E-Mail Removed)...
> I built a short and simple procedure on my PC, tested it, converted it to
> an
> xla, and made a button. I installed this button on a couple of
> colleagues'
> PCs.
>
> On only one PC, when the button is pressed, about a third of the macro
> runs,
> then the debug window shows, saying the code has been interrupted (as if I
> had pressed "Ctrl+Break"). If I hit "Continue", it then happily runs the
> rest of the code as if no problem ever existed.
>
> Do you know why, on one PC, Excel is acting as if I had pressed "Ctrl +
> Break"?
>
> thanks in advance
> Daniel


 
Reply With Quote
 
Daniel Bonallack
Guest
Posts: n/a
 
      17th Jun 2009
Thanks Rick and Bob,

I should have included this in the original paragraph, but it's actually
Excel 2003, Windows XP.

Here is the first part of the code:

_________________

Sub CreateOutput2()

MsgBox "You will be asked to open a file to check these deals against for
duplicates", vbOKOnly + vbInformation

blnNew = False

sActive = ActiveWorkbook.Name
Application.Dialogs(xlDialogOpen).Show
sCheck = ActiveWorkbook.Name
sCheckSh = ActiveSheet.Name
If sCheck = sActive Then End


The macro stops on the line "sCheck = ActiveWorkBook.Name".

I haven't defined my variables - do you think that could be it?

regards
Daniel

"Bob Umlas" wrote:

> Vista, Excel 2007, right? We've encountered this and have not yet found a
> workaround. Instructions to our users is to just click continue. Still
> trying to set it up so it happens consistently so we can report to
> Microsoft, but so far it seems pretty random, although with a particular
> application it happens very frequently. There's NO reason this should
> occur -- I pretty much know what I'm doing and for it to say code execution
> has been interrupted on a statement like End Sub is ridiculous!!
> I'm afraid you're going to have to just live with it!
> Bob Umlas
> Excel MVP
>
> "Daniel Bonallack" <(E-Mail Removed)> wrote in
> message news:8F60D92A-55DD-4B65-97D5-(E-Mail Removed)...
> > I built a short and simple procedure on my PC, tested it, converted it to
> > an
> > xla, and made a button. I installed this button on a couple of
> > colleagues'
> > PCs.
> >
> > On only one PC, when the button is pressed, about a third of the macro
> > runs,
> > then the debug window shows, saying the code has been interrupted (as if I
> > had pressed "Ctrl+Break"). If I hit "Continue", it then happily runs the
> > rest of the code as if no problem ever existed.
> >
> > Do you know why, on one PC, Excel is acting as if I had pressed "Ctrl +
> > Break"?
> >
> > thanks in advance
> > Daniel

>
>

 
Reply With Quote
 
Jim Thomlinson
Guest
Posts: n/a
 
      17th Jun 2009
Have you re-booted the computer where the error is occuring? I have had the
same experience that was fixed with a reboot...
--
HTH...

Jim Thomlinson


"Daniel Bonallack" wrote:

> I built a short and simple procedure on my PC, tested it, converted it to an
> xla, and made a button. I installed this button on a couple of colleagues'
> PCs.
>
> On only one PC, when the button is pressed, about a third of the macro runs,
> then the debug window shows, saying the code has been interrupted (as if I
> had pressed "Ctrl+Break"). If I hit "Continue", it then happily runs the
> rest of the code as if no problem ever existed.
>
> Do you know why, on one PC, Excel is acting as if I had pressed "Ctrl +
> Break"?
>
> thanks in advance
> Daniel

 
Reply With Quote
 
Rick Rothstein
Guest
Posts: n/a
 
      17th Jun 2009
Your code does not "stop" for me, so Jim's suggestion may end of working for
you. I do see a problem in the code you posted, though... you use an End
statement to shut down your code. Over in the compiled VB world I originally
came from, doing that could produce unwanted results (especially if objects
were involved) as the End statement stopped all running code and didn't give
the operating system an opportunity to do automatic (behind the scenes)
clean ups that might be necessary depending on what the code is actually
doing. I'm not sure if the same thing applies to VBA, but I would still not
use End to stop my code. VB has an Exit Sub (also Exit Function for
functions) which closes down running code and it is my understanding that it
allows for any behind the scenes clean ups that may be necessary.

--
Rick (MVP - Excel)


"Daniel Bonallack" <(E-Mail Removed)> wrote in
message news:A66F9E50-8D3B-4E21-8AC2-(E-Mail Removed)...
> Thanks Rick and Bob,
>
> I should have included this in the original paragraph, but it's actually
> Excel 2003, Windows XP.
>
> Here is the first part of the code:
>
> _________________
>
> Sub CreateOutput2()
>
> MsgBox "You will be asked to open a file to check these deals against for
> duplicates", vbOKOnly + vbInformation
>
> blnNew = False
>
> sActive = ActiveWorkbook.Name
> Application.Dialogs(xlDialogOpen).Show
> sCheck = ActiveWorkbook.Name
> sCheckSh = ActiveSheet.Name
> If sCheck = sActive Then End
>
>
> The macro stops on the line "sCheck = ActiveWorkBook.Name".
>
> I haven't defined my variables - do you think that could be it?
>
> regards
> Daniel
>
> "Bob Umlas" wrote:
>
>> Vista, Excel 2007, right? We've encountered this and have not yet found a
>> workaround. Instructions to our users is to just click continue. Still
>> trying to set it up so it happens consistently so we can report to
>> Microsoft, but so far it seems pretty random, although with a particular
>> application it happens very frequently. There's NO reason this should
>> occur -- I pretty much know what I'm doing and for it to say code
>> execution
>> has been interrupted on a statement like End Sub is ridiculous!!
>> I'm afraid you're going to have to just live with it!
>> Bob Umlas
>> Excel MVP
>>
>> "Daniel Bonallack" <(E-Mail Removed)> wrote in
>> message news:8F60D92A-55DD-4B65-97D5-(E-Mail Removed)...
>> > I built a short and simple procedure on my PC, tested it, converted it
>> > to
>> > an
>> > xla, and made a button. I installed this button on a couple of
>> > colleagues'
>> > PCs.
>> >
>> > On only one PC, when the button is pressed, about a third of the macro
>> > runs,
>> > then the debug window shows, saying the code has been interrupted (as
>> > if I
>> > had pressed "Ctrl+Break"). If I hit "Continue", it then happily runs
>> > the
>> > rest of the code as if no problem ever existed.
>> >
>> > Do you know why, on one PC, Excel is acting as if I had pressed "Ctrl +
>> > Break"?
>> >
>> > thanks in advance
>> > Daniel

>>
>>


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro Stops without reason ch Microsoft Excel Programming 6 4th Nov 2009 02:35 AM
Downloading stops for no reason ... penang@freemail.c3.hu Windows XP Help 13 29th May 2008 10:41 PM
Downloading stops for no reason ... penang@freemail.c3.hu Windows XP General 14 29th May 2008 10:41 PM
Code stops for no apparent reason =?Utf-8?B?UmVuw6k=?= Microsoft Excel Programming 4 30th Dec 2006 09:01 PM
Debugging stops for no reason? Brett Romero Microsoft C# .NET 0 15th Mar 2006 07:52 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:26 AM.