Hi all, the project I'm working on does the following:
1. Runs company reports from Excel
2. Saves the reports as MyFileXXX.xls
3. Calls a .vbs script which opens Outlook new message, adds MyFileXXX.xls as an attachment then sends the e-mail
My code is set to do this
1. Saves the .xls file to my 'temp' folder
2. Creates the new email (via vbs script) and adds the attachment
3. Pauses for 10 seconds (to give the email chance to send)
4. Moves the .xls file from 'temp' folder to 'proper' folder
The problem I am having is that only very rarely the email is created but for some reason the attachment isn't successfully attached in that 10 second window. The 'Move File' code then moves the file. The email then looks for the file (but of course it is missing) and so sends the email without an attachment.
Ideally, instead of me saying 'Pause for 10 seconds' - I'd like to be able to say. Pause until the vbs file has sent the email.
Is there a way for me to check that the vbs script has finished?
Thanks
John
Bookmarks