You're welcome. And you're right, I remember now that you may actually delete the file while Excel holds it in memory. Anyway, Try-Catch-Endtry is a real problem solver many times.
>Ahhh - in fact i'm not getting an error when i try to delete the open file only get the error when i try to replace the old one - so i stuck that in the try catch sequence and it works fine - thanks tore.
>k
>
>
>>If I understandyou your question correctly, you want to create a new file, to replace the old one. So if you try to delete the old file in a TRY - CATCH- ENDTRY block, you will be able to see whether you can delete the old file or not. If you can, you can go on, if not create a warning message.
>>
>>>would i not end up with the same error message tore?
>>>k
>>>>Try to delete the old file before creating the new file. If you can't delete the file, then it must be in use.
>>>>
>>>>>When i try and create an excel file programmatically AND a copy of the file is already open i get this message
>>>>>Cannot create file c:\mydir\myexcel.xls
>>>>>is there a way to test if file is open before trying to create it offering operator a warning to close existing file.
>>>>>thanks
>>>>>k