I ran across the following error today while doing a WRITELINE command in Active Server Pages (ASP) page where I was scraping a file then writing to a text file line-by-line:
Microsoft VBScript runtime error '800a0005'
Googling around I discovered that a handful of others that have had this problem. There are least 2 possible reasons for this when doing WRITELINE, such as scraping a very large file. However, my file was only about 30K, so I know that's not a problem. In fact, I was starting to get frustrated that I was in my 2nd day of trying to fix this -- probably exactly like the following person felt:
I've been trying to sort this for the last two days but I'm at my wits end. -justinp
Trudging on, I did find a solution. Sometimes a website can have special characters which you inherit via scraping. I don't know much about working with special characters, but I know enough that what is going on is not what things look like on the surface. One solution is to work in Unicode, but that destroys the ability to easily read the text via common editors.
So what I discovered is that special characters often appear as a series of questions marks in a common ASCII flat file. So the easiest solution is to just purge them, assuming you really don't need them anyway. However, as I eluded to, special characters act very weird. I wrote some code that would purge out any time multiple question marks are located next to each other (like ???? or ???????). However, for some reason, when treated as a string, the ???? doesn't appear as the string "????". So replacing the ???? with "" will not work.
Rather, it turns out that using analyzing strings one character at a time via MID provides a solution. Thus, I wrote some code that counts the question marks in each entry in the scrape that I'm looking at. Here it is:
public function CountQuestionMarksByLetter(someString)
dim t, counter
counter = 0
for t = 1 to len(someString)
if asc(mid(someString,t,1)) = 63 then counter = counter + 1
next
CountQuestionMarksByLetter = counterend function
This function counts the question marks. If the count is unusually high, I purge this section of the file. BTW, asc(63) = "?".
This has worked for me, hopefully it will work for you.