I posted this last week in Google Groups microsoft.public.infopath last week and got no takers. Maybe someone here can help?
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 (to run when a button is clicked in InfoPath), 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.
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 (to run when a button is clicked in InfoPath), 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.