VBA code refuses to compile in 2007, runs fine in 2003

J

Johan Verrept

Hello,

I have a relatively simple piece of code that works fine on 2003 but
refuses to compile on 2007. It refuses to compile this function with the
error

Function or interface marked as restricted or the function uses an
automation type not supported in Visual Basic.

and highlights "ChildNodes(1)".
Autocompletion still finds that member though. As far as I can tell all DLLs
are the same versions except the office DLLs themselves.

Any help or suggestions would be most appreciated,

Regards,
Johan

Sub PopulateDocumentCodeList()
Dim lws As New clsws_Lists ' Requires Web reference to to SharePoint
Lists.asmx
Dim xn As IXMLDOMNodeList ' Requires reference to Microsoft XML
Dim query As IXMLDOMNodeList
Dim viewFields As IXMLDOMNodeList
Dim rowLimit As String
Dim queryOptions As IXMLDOMNodeList
rowLimit = "100"
Dim xdoc As New DOMDocument
xdoc.LoadXml ("<Document><Query /><ViewFields /><QueryOptions
/></Document>")
Set query = xdoc.getElementsByTagName("Query")
Set viewFields = xdoc.getElementsByTagName("Fields")
Set queryOptions = xdoc.getElementsByTagName("QueryOptions")
Set xn = lws.wsm_GetListItems("Document Codes", "", query, viewFields,
rowLimit, queryOptions, "")

Debug.Print xn.item(0).XML

Dim item As IXMLDOMNode
For Each item In xn.item(0).ChildNodes(1).ChildNodes
If (item.BaseName = "row") Then
Call
DocumentCodes.Add(item.Attributes.getNamedItem("ows_Code").NodeValue,
(item.Attributes.getNamedItem("ows_LinkTitle").NodeValue + "|" +
item.Attributes.getNamedItem("ows_Default_x0020_Location").NodeValue))
End If
Next
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