Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
.Net Automation Add-In - Execution Always Ends in Edit Mode | Excel Programming | |||
.Net Automation Add-In - Execution Always Ends in Edit Mode | Excel Programming | |||
Aborting Execution Before Error Message | Excel Programming | |||
Macro dies in the middle of execution | Excel Programming | |||
Select a cell in the middle of a macro execution | Excel Programming |