Function using XMLDataQuery in Excel: Not refreshing automatically on worksheet

L

Luv2VBA

Greetings,

I hope someone can help me with this! This is my first attempt working
with XML, so please bear with me.

I have a simple user-defined function called "GetNode" (see below).
I want to be able to pass in the name of a node from my schema (map),
and have it return the value of that node. The function itself works as
it should, so when I enter in the equation in the worksheet as
=GetNode("LoanAmount"), it returns the correct value of the loan
amount for the cell that is mapped to the element LoanAmount.

Public Function GetNode(strNodeName As String) As String

Dim strFullNode As String

strFullNode = "/ns1:Loan/ns1:" & strNodeName
GetNode = ActiveWorkbook.Worksheets("Loan
Data").XmlDataQuery(strFullNode).Value

End Function


However, if I change the value of the LoanAmount cell in the worksheet,
the cell that has the equation calling the GetNode function does not
update automatically. In order to get it to display the updated value,
I have to double-click in the cell to activate it, and then it
re-calculates. (Calculation is clearly set to automatic, not manual)

Can anyone please explain to me why the equation would not update
automatically as I expect that it should? Or any other alternatives or
ideas? Thank you very much in advance!
 

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