View Single Post
  #12   Report Post  
Posted to microsoft.public.excel.programming
RB Smissaert RB Smissaert is offline
external usenet poster
 
Posts: 2,452
Default keep track of last code line before error

Hi Peter,

I have done it now like this:
All the Subs that need the line numbers (added with MZ Tools) will now pass
to a central error handler:

The procedure name
The Erl
The Err object, to get the error description and number.
Optional any extra data, such as for example the last SQL query.

This will be written to file and to the clipboard plus there is a msgbox as
well.
As I pass the procedure name the erl's don't have to be unique throughout
the project.
The only thing that now will need some attention is the routine I have to
strip the code of all text that is not
needed, such as comments etc.

RBS


"Peter T" <peter_t@discussions wrote in message
...
Hi Bart,

It doesn't appear possible to change the default options.

Thinking aloud, might be possible to number all lines in your project like
this

mmppxxxxx

mm module number 10-99
pp procedure number 01-99
xxxx line number 00010-99990

Let MZtools do the clever numbering stuff, not unique but first line in
each
proc starting with say 10

With each module - increment mm, reset pp
Export text in each module line by line to a text file after doing,
If a line starts with a number then
If it's 10 increment pp and reset xxxxx to "00010"
Else increment xxxxx by 10
Replace the old number with new mmppxxxxx
Re-import

No doubt some things to be careful with, eg next continuation line starts
with a number, increasing already very long lines too much.

Regards,
Peter T

"RB Smissaert" wrote in message
...
Is there a way in MZ Tools to add line numbers for one procedure and
set the starting number other than the default 1 to 10.
The idea is to have the numbering unique throughout the project.
This can be done if I do the whole project, but I don't want that and I

even
can't do
that (out of memory).

RBS

"RB Smissaert" wrote in message
...
Is it possible somehow to keep track of the last line of code that was

run
before a handled error occured without
adding line numbers or without adding a public variable that gets
incremented before every line?
I was thinking of perhaps a class handling VBE events, but I think I

will
need the public variable.
I am not keen to add line numbers.

RBS