Adding attachment to Outlook Email - Printable Version +- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums) +-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP) +--- Forum: UFT / QTP Beginners (https://www.learnqtp.com/forums/Forum-UFT-QTP-Beginners) +--- Thread: Adding attachment to Outlook Email (/Thread-Adding-attachment-to-Outlook-Email) |
Adding attachment to Outlook Email - mv8167 - 05-05-2012 i have code that creats and send an email after my testing completes. But I cannot seem to get the attachment to attach in Outlook v2007 pro. My code is such: Code: 'Returns O:\QTP Tests\NightlyRegressionTesting\Tests\Image Access - Check Fax Status by ENV\Res## RE: Adding attachment to Outlook Email - ssvali - 05-07-2012 Try this :- Code: newMail.Attachments.Add (strAttachment) RE: Adding attachment to Outlook Email - mv8167 - 05-07-2012 Thx Ssvali I tried newMail.Attachments.Add (strAttachment) earlier but I get a Run Error "The Operation failed...." I also tried just newMail.Attachments (strAttachment) which does not fail but no attachment is ever added. I did look over that the strAttachment is correctly found my file by testing If strAttachment <> "" Then, which passes. but, no file gets attached as thought. thx for your time. RE: Adding attachment to Outlook Email - ssvali - 05-08-2012 For me the below script is working fine. Code: Set olapp = CreateObject("Outlook.Application") RE: Adding attachment to Outlook Email - mv8167 - 05-09-2012 Mine still fails at: msg.Attachments.Add (fattach) I tried: Code: Set olapp = CreateObject("Outlook.Application") I do ret a Run Error: Cannot find this file. (but it is there) Thx for the idea |