in reply to is this file open?
What GrandFather said. Or you could even try and write an Excel file directly using Excel::Writer::XLSX.
The error message most likely comes from Excel itself when it tries to open the file and finds it locked by the existing Excel process. If pasting from Notepad is all you want to do in Excel at this point, writing the file using the above module will get rid of this problem. Otherwise you could try and add a timestamp to the file name so subsequently launched Excel processes won't try to step on each other's files. There is probably a way to find an already running Excel process (I'd guess Win32::Process::Info) and remote-control it using COM or something to reload the file, but I don't really have a clue how to do that, I'd just search the Win32:: module namespace for something that sounds like it would.