> Doug,
>
> Very inciteful... thank you for the information. For more clarification,
> the
> Word automation is initiated in Outlook 2007. When Outlook recieves an
> email,
> it kick off an Application_NewMail() function/event which is where
> everything
> starts...
>
> Basically what I am doing is grabbing a CSV file (feedback response file)
> from a website and bringing it into memory, parsing the information out of
> it
> to retrieve the persons name and email address. I use a distribution list
> in
> Outlook to store these names and email addresses, so I add them to the
> Distlist (by the way, I am also using Outlook Redemption so I don't get
> the
> security prompts).
>
> I already have a document (which is a musicians performance calendar) done
> in Word 2007 DOCX format (and also an HTML format), and use Sue Moshers's
> example of automating Word to use the Document as the body, set up an
> envelope to provide the name and email address it's going to, and then the
> send. Here is the function that does this;
> ______________________________________________________
> Sub SendCalendar()
> Dim wd As Word.Application
> Dim doc As Word.Document
> Dim itm As Object
> Dim ID As String
> Dim blnWeOpenedWord As Boolean
>
> On Error Resume Next
> Set wd = GetObject(, "Word.Application")
> On Error GoTo ErrHandler
> If wd Is Nothing Then
> Set wd = CreateObject("Word.Application")
> blnWeOpenedWord = True
> End If
> Set doc =
> wd.Documents.Open(FileName:="C:\Users\Administrator\Documents\Calendar for
> John Winters.docx", ReadOnly:=False)
> doc.MailEnvelope.Introduction = "This email is your confirmation for being
> added to the calendar list. Below you will find the currently published
> calendar. Please add this email address to your Safe Senders List."
> Set itm = doc.MailEnvelope.Item
> With itm
> .To = CalCheck.EmailAddress
> .SentOnBehalfOfName = "gary.bouchard[ at ]XXXXXXXX.net" (of course real
> address used here)
> .Subject = "John Winters Email Calendar confirmation"
> .Save
> ID = .EntryID
> End With
> Set itm = Application.Session.GetItemFromID(ID)
> itm.Recipients.ResolveAll
> itm.Send
> doc.Close
> If blnWeOpenedWord Then
> wd.Quit
> End If
> Set doc = Nothing
> Set itm = Nothing
> Set wd = Nothing
> Exit Sub
> ErrHandler:
> MsgBox Err.Description, vbCritical + vbOKOnly, "CalCheck.SendCalendar"
> Set doc = Nothing
> Set itm = Nothing
> Set wd = Nothing
> End Sub
> _________________________________________________________________
>
> Watching the code execute, there are no errors, and when the .Send
> function
> is hit, the message shows up the Outlook Drafts folder, ready to go, but
> it
> never gets sent.
>
> Perhaps I am missing a step?
>
> "Doug Robbins - Word MVP" wrote:
>
>> I am not sure what code you are using to send the document, but the
>> second
>> method in the article "How to send an email from Word using VBA" at:
>>
>>
http://www.word.mvps.org/FAQs/InterDev/SendMail.htm>>
>> works for me, or at least as it is modified in the article "Mail Merge to
>> E-mail with Attachments" at:
>>
>>
http://word.mvps.org/FAQs/MailMerge/MergeWithAttachments.htm>>
>>
>> --
>> Hope this helps.
>>
>> Please reply to the newsgroup unless you wish to avail yourself of my
>> services on a paid consulting basis.
>>
>> Doug Robbins - Word MVP
>>
>