This documentation is archived and is not being maintained.

Max Method

Office 2003

Returns a Variant that is the largest value of all of the numerical elements in a node set.

expression.Max(ByVal pxmllistInput As IXMLDOMNodeList) As Variant

expression Required. An expression that returns a reference to the Math object.

pxmllistInput Required IXMLDOMNodeList. The node set to search for the largest value.

returns A Variant that represents the largest value of all the numerical elements in a node set.

Security Level

0: Can be accessed without restrictions.


Note  This object model member is not supported when the Disable Service Pack features option on the Advanced tab of the Options dialog box in InfoPath is selected or when Microsoft Office 2003 Service Pack 1 or later is not installed. Any form that implements this object model member in its code will generate an error message if it is opened in InfoPath when service pack features are disabled or unavailable.


In the following example, maxAge is set to the maximum value of all of the numerical elements in the my:ages node set:

var ages = XDocument.DOM.selectNodes("//my:ages");
var maxAge = XDocument.Util.Math.Max(ages);

Applies to | Math Object