DeathSurfer
Programmer
Is it possible to pass an argument to a function that in turn returns an array? For some reason when I call the function getXmlElementNV from GetFBRData() below while passing an argument it will not pass the array back to me. The getXmlElementNV function gathers the node values from an xml file and is suppose to return them in an array. Can someone shed light?
------------------------------------------------------------
Sub GetFBRData()
'this loads and xml file
LoadXmlDoc ("C:\Excel Report Information.xml")
getXmlElementNV "worksheet_name"
End Sub
------------------------------------------------------------
Public Function getXmlElementNV(ElementName As String) As Variant
Dim xNodeList As IXMLDOMNodeList
'dim the xml element node value array
Dim xmlENVArray() As String
ReDim xmlENVArray(0)
Set xNodeList = xmlDoc.getElementsByTagName(ElementName)
Dim i As Long
For i = 0 To (xNodeList.Length - 1)
' make room for another worksheet in the array
ReDim Preserve xmlENVArray(i)
' add the worksheet to the array
xmlENVArray(i) = xNodeList.Item(i).childNodes.Item(0).nodeValue
Next i
' add the worksheets in the array to the output
getXmlElementNV = xmlENVArray
End Function
------------------------------------------------------------
Sub GetFBRData()
'this loads and xml file
LoadXmlDoc ("C:\Excel Report Information.xml")
getXmlElementNV "worksheet_name"
End Sub
------------------------------------------------------------
Public Function getXmlElementNV(ElementName As String) As Variant
Dim xNodeList As IXMLDOMNodeList
'dim the xml element node value array
Dim xmlENVArray() As String
ReDim xmlENVArray(0)
Set xNodeList = xmlDoc.getElementsByTagName(ElementName)
Dim i As Long
For i = 0 To (xNodeList.Length - 1)
' make room for another worksheet in the array
ReDim Preserve xmlENVArray(i)
' add the worksheet to the array
xmlENVArray(i) = xNodeList.Item(i).childNodes.Item(0).nodeValue
Next i
' add the worksheets in the array to the output
getXmlElementNV = xmlENVArray
End Function