Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Execution ends without error message in middle of program

I have several macros that I can not debug. When I run them in the debugger
they go along just fine and then act as if they they just encountered an END
statement. That is execution ends without any error message or other
indication of failure. The code lines do not seem to have any errors. For
example:
Selection.EntireRow.Hidden = True
I get a valid selection in the immediate window ( ? selection.address --
$1:$100) just before executing this line but the macro just stops. Once when
I tried to add an On Error Goto x I got a can not enter break mode here
message. Now execution just terminates.

Any ideas/tips
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Execution ends without error message in middle of program

Nothing obvious in the single line of code and your description. Do you have
user defined functions in the worksheet - if so, these can often be
problematic if not populated with good error handling code.

--
Regards,
Tom Ogilvy



"Richard J. Snee" wrote:

I have several macros that I can not debug. When I run them in the debugger
they go along just fine and then act as if they they just encountered an END
statement. That is execution ends without any error message or other
indication of failure. The code lines do not seem to have any errors. For
example:
Selection.EntireRow.Hidden = True
I get a valid selection in the immediate window ( ? selection.address --
$1:$100) just before executing this line but the macro just stops. Once when
I tried to add an On Error Goto x I got a can not enter break mode here
message. Now execution just terminates.

Any ideas/tips

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default Execution ends without error message in middle of program

I tend to avoid using Selection, as by itself you have no idea what it
evaluates to.

Maybe add:
Dim DelRange as range

set delrange=selection

Also, you can play with settings on :
ToolsOptionsGeneralError Trapping

NickHK

"Tom Ogilvy" wrote in message
...
Nothing obvious in the single line of code and your description. Do you

have
user defined functions in the worksheet - if so, these can often be
problematic if not populated with good error handling code.

--
Regards,
Tom Ogilvy



"Richard J. Snee" wrote:

I have several macros that I can not debug. When I run them in the

debugger
they go along just fine and then act as if they they just encountered an

END
statement. That is execution ends without any error message or other
indication of failure. The code lines do not seem to have any errors.

For
example:
Selection.EntireRow.Hidden = True
I get a valid selection in the immediate window ( ?

selection.address --
$1:$100) just before executing this line but the macro just stops. Once

when
I tried to add an On Error Goto x I got a can not enter break mode here
message. Now execution just terminates.

Any ideas/tips



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Execution ends without error message in middle of program

Some background:

Running on Windows 2000
Running Excel 2000 (9.0.8950 SP-2)
The company I am working for (Shell) as a contractor "locks" their PC's
preventing writing to most areas of the hard disk and registry. As I am
considered a "developer" I have both a locked and an unlocked PC. Unlocked PC
have access to most of the hard disk but apparently still lock some things.
Problem is the same on both. Therefore consider the possibility of a
rights/permissions problem.

I write most of my code by using the macro recorder and then editing it to
make it generic (example: I change the "hard" coding of file names to code
tyhat will handle any file name. same for ranges etc..)

I have some user defined function and subroutines but am not using them in
the lines of code that are crashing.

Particulars of problem:
Code seems to run to completion but does not do all that it should.
Then I trace it using the debugger code runs fine until it gets to problem
line and then just terminates as if it encountered an END statement. That is
there is no error message.

Code with problem is in a sub that is called by another sub. I read that ON
ERROR GOTO 0 does not always turn generic error checking back on ( the error
routines of calling procedures are still in effect?). To try to test for this
I added ON ERROR GOTO X: just before the problem line and at the bottom of
the same sub added X: and a msg. This was not triggered. The code continued
to end without warning and for no apparent reason.

On occasion (rarely) I have had this problem with other lines of code so it
may not be the line at all although when it does occur it is consistant i.e.
the same line continues to cause the problem and when commented out the
problem goes away.

My workaround has been to comment out or delete the code and code around the
issue it need be.

"Richard J. Snee" wrote:

I have several macros that I can not debug. When I run them in the debugger
they go along just fine and then act as if they they just encountered an END
statement. That is execution ends without any error message or other
indication of failure. The code lines do not seem to have any errors. For
example:
Selection.EntireRow.Hidden = True
I get a valid selection in the immediate window ( ? selection.address --
$1:$100) just before executing this line but the macro just stops. Once when
I tried to add an On Error Goto x I got a can not enter break mode here
message. Now execution just terminates.

Any ideas/tips

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
.Net Automation Add-In - Execution Always Ends in Edit Mode Matthew Wieder[_3_] Excel Programming 1 October 16th 06 11:12 AM
.Net Automation Add-In - Execution Always Ends in Edit Mode Matthew Wieder[_3_] Excel Programming 0 October 13th 06 04:07 PM
Aborting Execution Before Error Message MWS Excel Programming 4 December 13th 05 02:45 PM
Macro dies in the middle of execution JonR Excel Programming 3 October 29th 04 06:20 PM
Select a cell in the middle of a macro execution Dave Bash Excel Programming 4 January 25th 04 11:48 PM


All times are GMT +1. The time now is 09:44 PM.

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

About Us

"It's about Microsoft Excel"