• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

VBA generate a word doc and email it

Hi, kevinonearth!

No chance you can attach a file to an email if the file isn't stored in a folder, so to send a Word document you first have to save the data that's in memory handled by the Word application and then attach it to an email.

Regarding your question, after this lines:
Code:
' Save new file
objWord.ActiveDocument.SaveAs cDir + NewFileName
you have the Word file created. So using it there (i.e., trapping it and attaching to the email) would be your 1st choice.

Regards!
 
Ok, thanks, but having captured it, what is the code to use to email it?

' Save new file
objWord.ActiveDocument.SaveAs cDir + NewFileName

at this point do I create a new variable?
And how do I get VBA to send it to outlook?
Would it help if I attached the file here?

Thank you
 
Hi, kevinonearth!

Does this help?
http://www.rondebruin.nl/win/section1.htm
You have a lot of stuff regarding email in there.

I suggest you to go thru the sublinks and give it a try, it's one of the best ways to learn. But just in case you couldn't manage to handle it, just come back and someone'd surely will help you.

Regards!
 
Back
Top