Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #4  
Old 09-05-2014, 07:21 AM
gmayor's Avatar
gmayor gmayor is offline How to copy userform text and formfield contents to outlook? Windows 7 64bit How to copy userform text and formfield contents to outlook? 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
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to copy userform text and formfield contents to outlook? Formfield calculation Joachim Word 4 03-08-2013 01:56 AM
Copy all comments & cell contents (i.e. data) to word? IanM Excel 0 07-03-2010 11:14 PM
Copy the contents of a dcoument and paste it several times in a new document Gerjanst Word VBA 0 06-30-2010 12:51 PM
How to copy userform text and formfield contents to outlook? Checkbox on Userform result in Text in Word Dolfie_twee Word VBA 1 06-22-2010 07:54 AM
Auto populate formfield from dropdown menu jmofstead Word 0 02-26-2010 10:35 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 07:34 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft