B
Beth
Hello.
I'm trying to figure out how to determine the values entered into fields on
my Word document.
I've seen lots of examples using the formFields collection, but for whatever
reason, my collection is empty and my controls appear in the fields
collection instead.
I'm using Word 2003 and added a command button to use Outlook to return the
document.
When I iterate through the fields collection, the type always comes back 87
even though I have text boxes and a combo box, so I can't use it to determine
the field type.
What I'd like to do is something like this:
Private Function buildBody() As String
Dim fld As Field
Dim sBody As String
sBody = ""
For Each fld In Me.Fields
With fld
sBody = sBody & fld.Index & ": " & fld.Result.Text & Chr$(13) &
Chr$(10)
End With
Next
buildBody = sBody
End Function
but I can't get that to work.
The only way I've found to get the entered field value out of VBA code is to
reference the control directly, like:
?txtpmin.Text
12345678
Is there a way to iterate through the controls on the Word document and
determine the filled-in values?
Thanks for any help,
-Beth
I'm trying to figure out how to determine the values entered into fields on
my Word document.
I've seen lots of examples using the formFields collection, but for whatever
reason, my collection is empty and my controls appear in the fields
collection instead.
I'm using Word 2003 and added a command button to use Outlook to return the
document.
When I iterate through the fields collection, the type always comes back 87
even though I have text boxes and a combo box, so I can't use it to determine
the field type.
What I'd like to do is something like this:
Private Function buildBody() As String
Dim fld As Field
Dim sBody As String
sBody = ""
For Each fld In Me.Fields
With fld
sBody = sBody & fld.Index & ": " & fld.Result.Text & Chr$(13) &
Chr$(10)
End With
Next
buildBody = sBody
End Function
but I can't get that to work.
The only way I've found to get the entered field value out of VBA code is to
reference the control directly, like:
?txtpmin.Text
12345678
Is there a way to iterate through the controls on the Word document and
determine the filled-in values?
Thanks for any help,
-Beth