Hi all,
I'm not quite sure how to title what I'm trying to ask.
But basically I have a module running that at various points throughout requires some custom error handling which is basically If some value = whatever GoTo manual.
There are a few points throughout the code that can trigger GoTo manual (its not possible to have them all at the start unfortunately as some errors only become apparent as the code works through what its doing).
Originally, I wasn't using GoTo - I was simply writing the same handling code again and again (its a message box, do something, and then return to the start of the code (its a fairly big loop and the code runs again and again until its processed the data required)). Instead of doing that, and for ease of handling further errors I decided to create a GoTo "manual" where manual handles the aforementioned "do something" bit of code.
But I'm wondering how to place the "manual:" bit of code on the module - its currently at the end of my code, but I'm thinking, well if I'm processing a bit of data with no error triggers, it'll get to the end and still try to run whatever is after "manual:" won't it? it wont know to skip over this part of code.
So should it be another sub in the same module? but then GoTo doesnt work? or should I create another GoTo which is at the end of my code (before manual which can only be reached if the data has zero errors which simply skips over manual?
Sorry if that's a bit wordy. I'm just not sure what best practice is and I don't quite have the lingo to describe my problem cleanly
thanks all
I'm not quite sure how to title what I'm trying to ask.
But basically I have a module running that at various points throughout requires some custom error handling which is basically If some value = whatever GoTo manual.
There are a few points throughout the code that can trigger GoTo manual (its not possible to have them all at the start unfortunately as some errors only become apparent as the code works through what its doing).
Originally, I wasn't using GoTo - I was simply writing the same handling code again and again (its a message box, do something, and then return to the start of the code (its a fairly big loop and the code runs again and again until its processed the data required)). Instead of doing that, and for ease of handling further errors I decided to create a GoTo "manual" where manual handles the aforementioned "do something" bit of code.
But I'm wondering how to place the "manual:" bit of code on the module - its currently at the end of my code, but I'm thinking, well if I'm processing a bit of data with no error triggers, it'll get to the end and still try to run whatever is after "manual:" won't it? it wont know to skip over this part of code.
So should it be another sub in the same module? but then GoTo doesnt work? or should I create another GoTo which is at the end of my code (before manual which can only be reached if the data has zero errors which simply skips over manual?
Sorry if that's a bit wordy. I'm just not sure what best practice is and I don't quite have the lingo to describe my problem cleanly
thanks all