hi-
i'm trying to edit form fields of a word application using the following excel code
the form fields count gives me 0 and i don't understand why?Dim wrdApp As Word.Application Dim wrdDoc As Word.Document Dim dFormField As Word.FormField Set wrdApp = GetObject(, "Word.Application") If Err.Number <> 0 Then Set wrdApp = CreateObject("Word.Application") End If Set wrdDoc = wrdApp.Documents.Add(ThisWorkbook.Path & "\t2.docx") wrdDoc.Activate wrdApp.Visible = True For Each dFormField In wrdDoc.FormFields() MsgBox dFormField.Name Next MsgBox wrdDoc.FormFields().count
the .docx file is here
http://www.mediafire.com/?ubrntimb84xgrun
super appreciate any help
thanks
Hello Ac3Dc3,
Welcome to the Forum!
When I open the document and check the FormFields,, the count it is zero. Looking at the document in paragraph view also shows there are no FormFileds. The logical conclusion then is there are no FormFields.
Sincerely,
Leith Ross
Remember To Do the Following....
1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.2. Thank those who have helped you by clicking the Starbelow the post.
3. Please mark your post [SOLVED] if it has been answered satisfactorily.
Old Scottish Proverb...
Luathaid gu deanamh maille! (Rushing causes delays!)
Hi Leith! Thanks for the welcome.
I inserted the text, check box and date picker content controls at design-time using the controls section of the developer tab on the word ribbon. I thought that made them form fields? I guess not.
Do you have any tips on how to create these correctly? My goal is to use form fields to populate a word document from excel.
Thanks
Ac3Dc3
EDIT: ok so i guess these are content controls and not form fields then. oops! idk how to make form fields but i think i can do the same thing with content controls? i'll check it out
Last edited by Ac3Dc3; 07-04-2011 at 02:46 AM.
Please attach the file to the post, not everyone can access remote file shsre - I can't this one
Hope that helps.
RoyUK
--------
If you are pleased with a member's answer then use the Star icon to rate it, if you are pleased enough to part with cash consider a donation to Children in Need
For Excel Tips & Solutions, free examples and tutorials why not check out my downloads
New members please read & follow the Forum Rules
Remember to mark your questions Solved and rate the answer(s)
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks