Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Send all open Word documents to an Outlook email

Status
Not open for further replies.

9889

Programmer
Feb 28, 2003
15
GB
I would like to be able to send all open Word documents to an Outlook email.

Any help would be appreciated.

Thank you.
 
There is no built-in way to do this and it would require a macro. Would you want them as attachments, or in the body of the e-mail? Would you want them saved (to be attached they would have to be saved, but they could be saved as temporary files), or edits discarded afterwards?

Enjoy,
Tony

------------------------------------------------------------------------------------
We want to help you; help us to do it by reading this: Before you ask a question.

I'm working (slowly) on my own website
 
Hi Tony

Thanks for your reply and your help. I'd would want them sent as an attachment but not saved once they had been sent. Hope that makes sense.

Best Wishes

Angie
 
The basic logic is pretty simple ..

Instantiate Outlook (or attach to existing instance)
Create new mail item
Add To, Subject, Text if wanted
For each document
save as a temporary file
attach the temp file to the mail
Next
Send the mail
Delete the temporary documents

.. and I can give you code for this if you want. But ..

There is a problem. Word does not have a SaveCopyAs like Excel (somewhere at the back of my mind I seem to recall that Word 2010 might have, but I don't have a copy in front of me to check), so when you save a document as a temporary file, Word actually switches the document you are editing to being that new file - this will cause problems if you do want to save it later (because it is no longer the document originally edited). Somewhat annoyingly Word does have the capacity to save a copy and does so itself if you tell it to e-mail a document (but that, as I'm sure you know) only works for single documents.

So my question is, how would you like to handle this? Will you ever want to save your documents afterwards, or could they be closed - or possibly closed and re-opened (although that would lose the edits) or what? Perhaps it would be possible to create a new document and copy each in turn to it, before saving that as a temporary copy but if the documents were complex it would be hard to guarantee that the copy was the same as the original.


Enjoy,
Tony

------------------------------------------------------------------------------------
We want to help you; help us to do it by reading this: Before you ask a question.

I'm working (slowly) on my own website
 
I'd would want them sent as an attachment but not saved once they had been sent. "

As Tony's pseudo code shows, you MUST save the documents before you can send them as attachments. Attachments are files. You can, as Tony's code suggests, save them as temporary files, send those files, then delete those files.

So pay attention to his mention of versions, if that could be anissue.


unknown
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top