Determine the line number.
Forums
Hi There,
First, please have mercy. I learned English in school several decades ago and forgotten most of it. To translate the questions I've been working with the support of "Google Translate". The result is probably not perfect ;-) . I want to determine which command line is currently being processed in the macro? Can I might query a system variable? The reason for the question. If a subroutine is terminated due to an error, I would like to give the user a hint from what point in the main program was the entry into the subroutine.
Thanks
Hermann
Hi Brian,
Hi Brian,
thanks for your answer. Let me first explain something. I do not use the macro recorder for data preparation. For example, I generate an additional field with a single line of code in the Sub Main.
like this:
call new_numeric_field (file name, field name, Description, formula, decimal)
In the sub-functions I use the on error function. The user also gets an indication of the error and the name of the called function. Bug fixing would be easier if you could pass the line number from the main Sub. I could enumerate all function calls. Often, the main program must be adapted and manual numbering gets confused. So I wanted the main user (namely me) facilitate the work.
Hermann
Hello Hermann and welcome to
Hello Hermann and welcome to the site.
If you use the On Error Goto function you won't be able to see which line causes the error just the general location depending on how much information you have in the error message.
If you don't use the On Error Goto function then when the script fails you will have the line number (or a line number that is close).
So if you use the on error option you can give some additional information either than just a line number. So you could put this option in each of your functions and when it fails give a message in which function it failed, not sure if this is good enough for your users.
Let me know if this helped and we can discuss further.
Thanks
Brian