Refer to a field on a Word document in an email send from the documetn

I have a word form user fill out.  there is a data entried field called Client_Name. I need to have this in the title of an email, but how do I tell the code to grab this information?  I can get the email to work, but not the text information.

Private Sub CommandButton1_Click()
Dim olApp As Object
Dim olMsg As Object
Dim Doc  As Document
Dim fField As FormField
Dim objField As Object

''' strField = Fields.FieldName = "Client_Name"
Set objField = Doc.FormFields("Client_Name").TextInput.Va

Set olApp = CreateObject("Outlook.Application")
Set olMsg = olApp.CreateItem(0)
Set Doc = ActiveDocument


With olMsg
.To = "mwawro@firstrepublic.com"
''' .Subject = "Wire Tracer" & Doc.FormFields(0)
.Subject = "Wire Tracer" & objField
.Body = "Please review"
.Attachments.Add Doc.FullName
.Send
End With

Set olMsg = Nothing
Set olApp = Nothing

End Sub
Sandra SmithRetiredAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

David Johnson, CD, MVPOwnerCommented:
tell the code to grab this information

Where is it going to be coming from, contact information, email address i.e.
John Doe <john.doe@example.com>, a database?
0
DrTribosCommented:
What kind of field are you using?

Not sure what this line is: Set objField = Doc.FormFields("Client_Name").TextInput.Va
.Va??

try changing .Subject = "Wire Tracer" & objField

to
.Subject = "Wire Tracer" & objField.code OR
.Subject = "Wire Tracer" & objField.result
0
Sandra SmithRetiredAuthor Commented:
Actually discovered the control was a ContextControl and I needed to use that syntax.  It was not a FormField!  thank you all for the advise, but once I discovered that, I could enter the correct code.

Sandra
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Sandra SmithRetiredAuthor Commented:
It was a ContextControl not a FormField.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Applications

From novice to tech pro — start learning today.