Jump to content
Sign in to follow this  

Attachment via CDO

Recommended Posts


Hey guys so im having some issues..

I use autoit to attach and send an email however i keep getting this error:

@@ Debug(62) : $S_Files2Attach = 
>Error code: 0
### COM Error !  Number: 80020009   ScriptLine: 193   Description:The process cannot access the file because it is being used by another process.

>Exit code: 0    Time: 1.813

i am trying to send a normal .xls and it shouldnt be open as in my VBA code it closes the workbook before even running the script to check and email out the file and i use this exact same script im using to email other .xls files and it works fine...

When i try and manually open the file im trying to attach i get 'the file you are trying to open is in a different format than specified by the file extension' 'verify that it is not corrupted' do you want to open?

i click yes, file is 100% fine..... and not only that my VBA macro will manipulate that spreadsheet with no problems without having opened it before in that extension(so the warning would still pop up, theoretically)

So is it that this warning stopping the file straight away that is causing it? and if so is there a way around? i dont really understand why it would make a difference as its attaching the file not opening it but then again im not too sure..

Have closed excel completely, run script to attach and send - still falls over, email still sends just doesnt attach the .xls

Any help would be great!

Edited by 13lack13lade

Share this post

Link to post
Share on other sites

If you have closed Excel and your script still fails then some other application seems to lock the file.

My UDFs and Tutorials:


Active Directory (NEW 2017-04-18 - Version - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version - Download - General Help & Support

ADO - Wiki


Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.