GaryDC
asked on
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
Dim wordApp As New word.Application
Dim wordDoc As word.Document
Set wordDoc = wordApp.Documents.Open("c:
MsgBox wordDoc.FullName //this is correct
MsgBox wordDoc.FormFields.Count //this is zero
wordDoc.Close
wordApp.Quit
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
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!
I don't actually want the number of fields, it was just a concise way of demonstrating that it wasn't working!
ASKER
Up and running - thank you both
Why do you want the number of form fields in your document?