Error Message Even when I have Error Handling
Hello, I am new to vba, but I've worked in several other languages before, yet I am new to error handling and synchronizing a program in general.
In vba (for excel), I have a project that goes through a web form, fills it out, exports the resulting data to a csv in Excel, grabs the data off of the csv, puts it on a separate workbook, repeats the process until all of the forms are done and the workbook has all of the data.
Recently, I added in an error handler that would go through and, if the csv file had not finished downloading, thus giving the "Subscript out of range" error, it would loop through until the csv is finished downloading, is properly called, and dealt with.
The code works perfect when single stepping because the code has more time to wait on various objects and things like that, however when the program is run, it gets ahead of itself and trips over the csv, hence the error handler, and I am unsure how to synchronize the process and the MS Help tends to be simply god awful in assistance on such matters for some one of my youth in the field. (And yes, I have searched both the MS Macros Help and the Internet for a solution to no avail)
While I have the error handler, I still get the "Subscript out of range" error message (this is a new occurrence and did not happen before I tried to give the handler a way to get out of an endless loop by using an integer counter). Is there any recommendation/hints on how to synch/deal with the message/improve the method of the error handling? (possibly a command that would make the error handling loop pause temporarily???)
Re: Error Message Even when I have Error Handling
The problem that you are facing may occur if the following conditions are true:
- The active cell is above the horizontal page break or to the left of the vertical page break that is referred to by the HPageBreaks or VPageBreaks index.
- The vertical or horizontal page break location is off the screen to the right of the visible window or below the visible window of the workbook.
For workaround, check this link - http://support.microsoft.com/kb/210663
Re: Error Message Even when I have Error Handling
Actually, after tinkering around a bit, I got the darned thing to work by taking out the elseif statements I had in the error handler, it will still occur if an error other than one handled by the handler (Currently only error #9 Subscript out of range) But yeah, this problem is solved for now, however this leads me to ask, why did it not like my elseif statements? (which were meant for further debugging) Does vba force me to create and OnError inside of the Error handler in order to sift through others?