The formatting requirements of HTML e-mail and word document are different;
however if it is only the results of the form fields that you are interested
in, it is simple enough to e-mail those in the form of (say) a comma
delimited file. The following macro will extract the content of each field
(check boxes copy as 0 or 1) and write it into a throw away Word document as
a comma delimited file. When all the fields are extracted, the macro then
e-mails the resulting comma delimited file to the e-mail address indicated.
You will need to add the Microsoft Outlook Object Library to vba Tools >
References for this to work.
I have set the macro to display the message. If you want to simply send it,
change the line .Display to .Send
Sub ExtractData()
Dim oFld As FormFields
Dim sText As String
Dim i As Long
Dim bStarted As Boolean
Dim oOutlookApp As Outlook.Application
Dim oItem As Outlook.MailItem
Dim dDataDoc As Word.Document
Dim dSource As Word.Document
Dim objDoc As Word.Document
Set dSource = ActiveDocument
Set dDataDoc = Documents.Add
Set oFld = dSource.FormFields
Application.ScreenUpdating = False
For i = 1 To oFld.Count
sText = oFld(i).Result
dDataDoc.Activate
If i <> 1 Then Selection.TypeText ","
Selection.TypeText sText
If i = oFld.Count Then Selection.TypeParagraph
dSource.Activate
Next i
dDataDoc.Range.Copy
'Get Outlook if it's running
Set oOutlookApp = GetObject(, "Outlook.Application")
'Outlook wasn't running, start it from code
If Err <> 0 Then
Set oOutlookApp = CreateObject("Outlook.Application")
bStarted = True
End If
'Create a new mailitem
Set oItem = oOutlookApp.CreateItem(olMailItem)
Set objDoc = oItem.GetInspector.WordEditor
With oItem
.To = "(e-mail address removed)"
.Subject = "Data Return"
objDoc.Range.Paste
.Display
End With
'Clean up
Application.ScreenUpdating = True
Set oItem = Nothing
Set oOutlookApp = Nothing
End Sub
http://www.gmayor.com/installing_macro.htm