Populating Repeating Table with VB Script

C

Charles Simpson

Hello Everyone!

I'm using InfoPath 2007 client. I'd like to place a button on the form to
populate a repeating table using the following script:

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objTextFile = objFSO.CreateTextFile("c:\scripts\TEWIW001-Software.tsv",
True)

strComputer = "TEWIW001"
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colSoftware = objWMIService.ExecQuery _
("Select * from Win32_Product")

objTextFile.WriteLine "Vendor" & vbtab & _
"Name" & vbtab & "Version" & vbtab & _
"Install State" & vbtab & "Install Date" & vbtab & _
"Install Location"

For Each objSoftware in colSoftware
objTextFile.WriteLine objSoftware.Vendor & vbtab & _
objSoftware.Name & vbtab & _
objSoftware.Version & vbtab & _
objSoftware.InstallState & vbtab & _
objSoftware.InstallDate & vbtab & _
objSoftware.InstallLocation
Next
objTextFile.Close

The vb script above currently writes the results to a csv file stored on the
local computer. I'd like for it to run when the button on the form is
executed and to populate a repeating table on the form instead of creating a
csv file.

Thanks!
 

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