Passing data into Infopath template/forms from a VB6 Application

F

fnb

Currently we retrieving data from a legacy (Unix) application using a VB6
windows forms application. The data is then passed to Word Templates for
printing.

Can we also do the same with Infopath Templates ? How ?

Thanks a lot.
 
S

S.Y.M. Wong-A-Ton

You can use automation:
http://msdn2.microsoft.com/en-us/library/ms788215(office.11).aspx
http://msdn2.microsoft.com/en-us/library/aa167748(office.11).aspx

You can pass data into a form:
http://support.microsoft.com/kb/896451
http://blogs.msdn.com/infopath/archive/2007/02/26/passing-data-into-a-form-input-parameters.aspx

An InfoPath form is an XML file based on a template (create a form template,
fill it out, save it locally, and open it with Notepad to see what I mean).
So you can programmatically create an XML file that points to a form template
in VB and fill it with the data you need to fill it with. If you are unable
to programmatically create the XML file, you can also create a sample XML
file based on a template, open that file in VB, and replace values in the
file with the values from your legacy application.
 
F

fnb

Thanks a lot. That was very helpfull.

My follow up question is ---

How do I print an Infopath form from a VB6 Application - silently - that is
the InfoPath application will not show up on the destop ?"

I have this code:

===============================================

Option Explicit

Dim IPApp As InfoPath.Application
Dim IPDoc As InfoPath.XDocument


Private Sub Command1_Click()

Set IPApp = New InfoPath.Application

Set IPDoc = IPApp.XDocuments.Open(App.Path + "/Form1.xml", 8)

IPDoc.PrintOut

If IPApp.XDocuments.Count > 0 Then
For I = IPApp.XDocuments.Count - 1 To 0 Step -1
IPApp.XDocuments.Close (I)
Next
End If

IPApp.Quit

Set IPApp = Nothing

End Sub

===============================================

However this will create an instance of the Infopath form that is visible to
the user.

Thank you.
 
S

S.Y.M. Wong-A-Ton

I don't think silent printing is possible. In any case, I haven't yet found a
way to hide the application while printing.
 
F

fnb

Okey, I need your comment then:

As we have lots of Word Templates (in English and Arabic), with various
formatting requirements (e.g. data on headers and footers, tables, sections
etc), and since we are just printing this documents (hard copy), is it
advisable to move them to Infopath ?

Thanks a lot.
 
S

S.Y.M. Wong-A-Ton

No, if you're just printing, Word will do a much better job than InfoPath. On
the other hand, if you want to save form data in a way that can be easily
stored and shared between applications (since its XML), then I would advise
the use of InfoPath. Formatting and printing are not strong points of
InfoPath.
 
H

Hepzibah

fnb said:
Currently we retrieving data from a legacy (Unix) application using a VB6
windows forms application. The data is then passed to Word Templates for
printing.

Can we also do the same with Infopath Templates ? How ?

Thanks a lot.

Trying to retrieve data from a file that I replaced with update data that
was a new document, first document has all the info needed for the second doc.
 

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