Form Fields in Word have trailing spaces
Thank you, I will test.
--
MD
"Barb Reinhardt" wrote:
Try this for a test
Sub Test()
Dim objDoc As Document
Dim objWord As Application
Dim myFormField As FormField
Set objDoc = ThisDocument
For Each myFormField In objDoc.FormFields
Debug.Print myFormField.Name, myFormField.TextInput.Type,
myFormField.TextInput.Type
If myFormField.Type = wdFieldFormTextInput And _
myFormField.TextInput.Type = wdRegularText Then
myFormField.Result = "Hello"
End If
Next myFormField
End Sub
--
HTH,
Barb Reinhardt
If this post was helpful to you, please click YES below.
"Lynn" wrote:
yes, here is a sample where the bookmark (form field) text is set.
(All bookmark values are set in this manner.)
objDoc.Bookmarks("txtParagraph1").select
objWord.Selection.Text = strParagraph1
Do you need more details?
Thanks!
--
MD
"Barb Reinhardt" wrote:
Can you show some of the code you use to do this?
Barb Reinhardt
"Lynn" wrote:
I am able to automate the pushing of data from an Excel spreadsheet to a Word
document that has form fields using VBA. However, the data that is populated
to its respective field pushes the form field 5 spaces to the right of the
data. How do I program the data to populate "into" the field without
incurring extra spaces. NOTE: This scenario doesn't always happen after
running the Excel VBA code.
Thanks!
--
MD
|