Populate a Word table from an InfoPath form using VBScript

D

darkstar

Does anyone know how to populate a Word table with data from an
InfoPath form using VBScript?
I've already figured out how to open the Word template and transfer
data from single XML nodes to bookmarked locations:

Set Title = XDocument.DOM.selectSingleNode("//my:Title")
strTitle = Title.Text

Set Author = XDocument.DOM.selectSingleNode("//my:Author")
strAuthor = Author.Text

Set objWord = CreateObject("Word.Application")
objWord.Visible = True

Set objDoc = objWord.Documents.Open("C:\Test\Template.doc")

Set objRange = objDoc.Bookmarks("Title").Range
objRange.Text = strTitle

Set objRange = objDoc.Bookmarks("Author").Range
objRange.Text = strAuthor

<and so on...>

This works fine, but I'm stumped on how to transfer data in tables.

If someone could tell me the equivalent in VBScript of the following
VBA code, I think I can make this work:

With Selection
.GoTo What:=wdGoToBookmark, Name:="TestTable"
.TypeText Text:="1"
.MoveRight Unit:=wdCell
.TypeText Text:="3F"
and so on...>

End With

Thanks in advance for any help or suggestions.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top