Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
fill in Word Document form fields - VBA in QM
#2
I have gotten a little farther:


Code:
Copy      Help
VARIANT  filepath  =  "C:\Pick the date.docx"
VARIANT s
typelib Word {00020905-0000-0000-C000-000000000046} 8.0
Word.Application oApp._create
Word.Document oDoc = oApp.documents.open(filepath s s)
oApp.Visible = "true"
out oDoc.FormFields.Count
oDoc.Close
oApp.Quit
;


this will open the doc in non-locked mode but doesn't show any form field count even when I am using a document made from a template with lots of fields.
Until some fields are recongized then the actions on FormFields index/bookmark can't occur.


When I try this:

Code:
Copy      Help
VARIANT  filepath  =  "C:\Pick the date2.docx"
VARIANT s
typelib Word {00020905-0000-0000-C000-000000000046} 8.0
Word.Application oApp._create
Word.Document oDoc = oApp.documents.open(filepath s s)
oApp.Visible = "true"
out oDoc.FormFields.Count
VARIANT t = "TestField"
oDoc.FormFields.Item(t).Result = "John Doe"

I get the result

Error (RT) in Macro: 0x800A1735,
The requested member of the collection does not exist



I think I am getting closer but can't figure out why the VB doesn't recognize the fields.

Thanks for any thoughts,
S


Messages In This Thread

Forum Jump:


Users browsing this thread: 2 Guest(s)