FormFields Collection is Empty

I simply want to access the contents of a TextBox and a ListBox on an existing document, but the FormFields collection is always empty even though the document has a TextBox called TextBox1 and a ListBox called ListBox1. What's the stupid error here? The code is as follows:-

Dim wordApp As New word.Application
Dim wordDoc As word.Document

Set wordDoc = wordApp.Documents.Open("c:\temp\MS Forms\gary.doc")
MsgBox wordDoc.FullName //this is correct
MsgBox wordDoc.FormFields.Count //this is zero

wordDoc.Close
wordApp.Quit
GaryDCAsked:
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.

MCummings111400Commented:
You may be using the VBA controls for a Listbox and a Textbox and not Word Form Fields. Word Form Fields look like flat grey areas on your document. VBA Controls look like the real thing.

Why do you want the number of form fields in your document?
0
bobbit31Commented:
try this instead:

For i = 0 To wdDoc.Content.InlineShapes.Count
    MsgBox wdDoc.Content.InlineShapes(i).OLEFormat.Object.Value '' the value of the control
Next
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
GaryDCAuthor Commented:
Well they look like the real thing. In that case could you please give me a quick pointer to accessing VBA controls?

I don't actually want the number of fields, it was just a concise way of demonstrating that it wasn't working!
0
GaryDCAuthor Commented:
Up and running - thank you both
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
Visual Basic Classic

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.