I wanted to see if I could reproduce the failure at line 16379. Using your program in HTBasic 2021 I could not get it to fail. It completed successfully every time. I did see that you were using HTBasic 10.0 and HTBasic 10.1 so I tried those versions and immediately get an error in each and they shutdown which is very odd. If I get the time I will look into it, although since it works fine in our latest release, my recommendation is to use it.
Ralphs suggestion is a good one and will be much faster than going through Excel, but if you need to go through Excel for some reason, I would recommend using HTBasic 2021.
Concerning how I entered my code in my post, I use the HTML CODE tags provided on the toolbar above and put my code between them.
If you do get a copy of HTBasic 2021, I would be interested to know if HTBDDE works successfully for you, or you still hit the same issue.