Automating Infopath

P

pRaDiPtO

HI
i am new to infopath and the msdn site has been of great help
i am engaged in automating infopath applications.
here i encountered a problem.
we can open an external xml file using vba code snippet( got from msdn)
//////////////////
Dim objIP As Object

'Create the ExternalApplication object and open a specified form.
Set objIP = CreateObject("InfoPath.ExternalApplication")
objIP.Open ("C:\My Forms\Form1.xml")
Set objIP = Nothing

///////////////////////

but i want to open the infopath application with the form using vb script
so i did
/////////////////
<script type="text/vbscript">

dim myIP
dim obj
Set myIP=CreateObject("InfoPath.ExternalApplication")
myIP.Application.Visible=True
*****myexcel.Open ("C:\\Form1.xml")*****
</script>

The problem is that infopath is opening but not loading the form. can you
help me which argument to use to open a specified file in infopath.

i also tried using javascript

////

<script>
var w=new ActiveXObject('InfoPath.ExternalApplication');
var obj;
w.Visible = true;
***obj=w.Documents.Open("C:\form1.xml");**
</script>

/////

here also i am opening infopath but the form is not opening .

i think i need to change ** line.
plz come up with your comments & suggestions.
Thanks
Pradipto

Regards

Pradipto

INDIA
 
S

Scott Heim

Hi Pradipto,

Here are steps I followed that appear to work:

- Created an Notepad document
- Entered just the following code:

Dim myIP
Set myIP=CreateObject("InfoPath.ExternalApplication")
myIP.Open "C:\Test.xml"

- Saved this as: Test.vbs
- Tested - result: my Test.xml file on my "C" drive launched without issue.

Let us know if you still have an issue!
 

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