Try addingRight after that lineDo Events
"Do Events" tells the code to let Windows handle everything that just happened before continuing. It's not a real bad idea to use Do Events whenever the code does important things.
A cursory scan of your code sees ~8 places where Do Events could be appropriate.