View Single Post
 
Old 09-05-2014, 07:21 AM
gmayor's Avatar
gmayor gmayor is offline Windows 7 64bit Office 2010 32bit
Expert
 
Join Date: Aug 2014
Posts: 4,137
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

You won't have to unprotect the form if you process the copied data in the message as it will already be unprotected there e.g. as follows.
You can change the wingding characters to those you prefer.

Code:
Option Explicit

Private Sub EmailData()
Dim OutApp As Object
Dim OutMail As Object
Dim OutInsp As Object
Dim OutDoc As Word.Document
Dim oFld As Word.FormField
Dim oRng As Word.Range

    Set OutApp = CreateObject("Outlook.Application")
    Set OutMail = OutApp.CreateItem(0)
    With OutMail
        .To = "EmailAddressHere"
        .Subject = "SubjectHere"
        .Display
    End With

    Set OutInsp = OutMail.GetInspector
    Set OutDoc = OutInsp.WordEditor

    ActiveDocument.Content.Copy
    OutDoc.Range.PasteAndFormat Type:=wdFormatOriginalFormatting
    For Each oFld In OutDoc.Range.FormFields
        Set oRng = oFld.Range
        If oFld.Type = wdFieldFormCheckBox Then
            If oFld.CheckBox.Value = True Then
                oRng.InsertSymbol _
                        Font:="Wingdings", _
                        CharacterNumber:=-3842, _
                        Unicode:=True
            Else
                oRng.InsertSymbol _
                        Font:="Wingdings", _
                        CharacterNumber:=-3985, _
                        Unicode:=True
            End If
        Else
            oRng.Text = oFld.Result
        End If
    Next oFld
    Set oFld = Nothing
    Set oRng = Nothing
    Set OutInsp = Nothing
    Set OutMail = Nothing
    Set OutDoc = Nothing
    Set OutApp = Nothing
End Sub
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote