VBA ?? - External Automation

J

Jonathan Lyall

Has anyone ported the lab 16 that uses jscript into VBA.

I get stuck with the following.

The Line Set oXmlDocument = oXDocument.DOM reports an error "Automation
Interface is Not registered"

The jscript version of this code works great. I guess my other option is to
call the jscript from the VBA ?

Cheers

Jono


code snippert ************************
Private Sub CommandButton1_Click()
Dim oApp As New InfoPath.Application
Dim oXDocumentCollection As XDocumentsCollection
Dim oXDocument As XDocument
Dim oXmlDocument As New MSXML2.DOMDocument50

Set oXDocumentCollection = oApp.XDocuments
Set oXDocument = oXDocumentCollection.NewFromSolution("C:\Price\order2.xsn")


Set oXmlDocument = oXDocument.DOM

oXmlDocument.setProperty "SelectionNamespaces",
"xmlns:q=""http://schemas.microsoft.com/office/infopath/2003/ado/queryFields
""" _
& "
xmlns:d=""http://schemas.microsoft.com/office/infopath/2003/ado/dataFields""
" _
& "
xmlns:dfs=""http://schemas.microsoft.com/office/infopath/2003/dataFormSoluti
on""" _
& "
xmlns:my=""http://schemas.microsoft.com/office/infopath/2003/myXSD/2003-01-2
9T17:00:30"""

Dim oOrderQuery As IXMLDOMElement

Set oOrderQuery = oXmlDocument.selectSingleNode("//q:OrderHeader")

oOrderQuery.SetAttribute "OrderNo", "12"
oXDocument.Query

Set oXDocumentCollection = Nothing
Set oApp = Nothing



End Sub
 

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