I have a script which pastes some text in excel via COM.
The problem is: sometimes it works perfectly. Some times it gives me an error.
What could be causing those random errors?
The excel sheet stays always opened. This is the entire excel code. After that im just using the extracted variables
Code: Select all
excel := ComObjActive("Excel.Application")
excel.Range("B1").PasteSpecial(-4104)
msgcopiada := excel.Range("A1").Value
bh_ou_longe := excel.Range("N17").Value
numerozap_contato := excel.Range("M4").Value
clipboard := msgcopiada
excel.columns("B").clear