PDA

View Full Version : Emailing Word Forms



emurphy35
03-09-2006, 08:47 AM
I created a form in word. When the user has completed the form, I would like to have a button for them to click that would email the form to a predefined mailbox. If anyone can give me some help it would be appreciated.

Ed

emurphy35
03-09-2006, 11:27 AM
I found a solution in the Word Forum.

Thanks,
Ed

mdmackillop
03-09-2006, 02:13 PM
Hi Ed,
Welcome to VBAX
If you can post the solution or a link to it, that would be useful for anyone who finds themselves here!
Regards
MD

emurphy35
03-10-2006, 10:52 AM
Cannot find the link, but here is the code I use.


Option Explicit
Sub eMailActiveDocument()
Dim OL AsObject
Dim EmailItem AsObject
Dim Doc As Document

Application.ScreenUpdating = False
Set OL = CreateObject("Outlook.Application")
Set EmailItem = OL.CreateItem(olMailItem)
Set Doc = ActiveDocument
Doc.Save
With EmailItem
.Subject = "Insert Subject Here"
.Body = "Insert message here" & vbCrLf & _
"Line 2" & vbCrLf & _
"Line 3"
.To = "User@Domain.Com"
.Importance = olImportanceNormal 'Or olImprotanceHigh Or olImprotanceLow
.Attachments.Add Doc.FullName
.Send
End With

Application.ScreenUpdating = True

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

End Sub