vb.net - Visual basic text fields data to MS Word document -


i need create form data have transferred ms word document text fields

private sub button1_click(sender object, e eventargs) handles button1.click     dim myapp1 object     dim mydoc1 object     myapp1 = createobject("word.application")     mydoc1 = myapp1.documents.open(c:\dsu.docx")     mydoc1.field("w_vardaspavarde").range = vardaspavarde.text     mydoc1.fields.update()     mydoc1.fields.unlink()     myapp1.visible = true end sub 

code above opening word document, fields lefts empty. looking advice.

to code work

  • you need index fields collection

  • to index fields collection have use number (a long), not text value

  • but that, have know number use.

but type of field trying replace? ref field? if choice , need use fields, may better off using { docvariable } fields , setting values of corresponding variables. or, if need support windows word 2007 , later, might better use content controls linked custom xml.


Comments

Popular posts from this blog

css - Which browser returns the correct result for getBoundingClientRect of an SVG element? -

gcc - Calling fftR4() in c from assembly -

Function that returns a formatted array in VBA -