View Single Post
 
Old 09-04-2014, 11:40 AM
frlan2a frlan2a is offline Windows 7 64bit Office 2010 64bit
Novice
 
Join Date: Sep 2014
Posts: 2
frlan2a is on a distinguished road
Default Prefilled email with information contained in a Word document

Hi,

Would anyone be able to help me with this one ? I want to create Macro that would be linked to a button and that will be used to send an email with some information that are contained in a word document.

I essentially want to prefill the email adresses, subject and body of the email. The main difficulty is that the body of the email is a table of variable row in the word document. I was trying to put the information required in formfeilds in the word document, but I don't know if this is the best way to go.

If anyone has any advice or ideas please let me know !

Thanks a lot for your help.


----------------------------------------

Private Sub SendEmail_Click()

Dim OL As Object
Dim EmailItem As Object
Dim Doc As Document

Set OL = CreateObject("Outlook.Application")
Set EmailItem = OL.CreateItem(olMailItem)
Set Doc = ActiveDocument
Doc.Save

With EmailItem
.Subject = "Disposition of AIDC Destructive Tests"
.Body = "Email Information" & vbCrLf & _

" Table form the word document here "

.To = "Addresses Contained in the Word Document"
.Importance = olImportanceNormal
.Attachments.Add Doc.FullName
End With

EmailItem.SendMail

Set Doc = Nothing
Set OL = Nothing
Set EmailItem = Nothing

End Sub

----------------------------------------
Reply With Quote