Hi ann, welcome to LAVA.
I have run into similar problems before and have read other threads about this as well.
The first thing I noticed is that you were not closing the VISA reference after executing your code, this leaves an open reference to the COM port and may result in an error when you try to run your program next time as the VISA resource may still be considered "open" from the previous execution of your code.
Some serial instruments have some intelligent handshaking codes to verify when a command has ben executed, others don't. I have found that if you can't determine when the instrument has executed a command, insert a short delay between writing and reading to/from the COM port. It's not elegant but it works 90% of the time.
I have attached an image of a suggested solution to try. Without the instrument attached it is a bit difficult to test though.
Cheers & Beers
:thumbup: & :beer: