I could speculate, but the best way to debug this kind of problem is to look at the script log to see what's happening. If you can't figure out what the problem is from the log, please post the relevant portion of the log here.
BTW, when I do this kind of processing I usually walk the tables backwards, avoiding the changing index problem.
For vTableNo = vNoofTables-1 to 0 step -1 ;
vTableName = TableName(vTableNo) ;