Applies to: IXMLDOMElementsetAttribute Method  [Visual Basic]
Sets the value of the named attribute.[Script] 
Script Syntax
oXMLDOMElement.setAttribute(name, value);
Parameters
name 
The string specifying the name of the attribute. If the attribute with that name already exists, its value is changed. If the attribute with that name does not exist, it is created. 
value 
The variant that supplies the value for the named attribute. 
Example
var xmlDoc = new ActiveXObject("Msxml2.DOMDocument.4.0");
var nodeBook;
xmlDoc.async = false;
xmlDoc.load("books.xml");
nodeBook = xmlDoc.selectSingleNode("//book");
nodeBook.setAttribute("PublishDate", String(Date()))
alert(nodeBook.getAttribute("PublishDate"));
[Visual Basic] 
Visual Basic Syntax
oXMLDOMElement.setAttribute(name, value)
Parameters
name 
The string specifying the name of the attribute. If the attribute with that name already exists, its value is changed. If the attribute with that name does not exist, it is created. 
value 
The variant that supplies the value for the named attribute. 
Example
Dim xmlDoc As New Msxml2.DOMDocument40
Dim nodeBook As IXMLDOMElement
xmlDoc.async = False
xmlDoc.Load "books.xml"
Set nodeBook = xmlDoc.selectSingleNode("//book")
nodeBook.setAttribute "PublishDate", Now
MsgBox nodeBook.getAttribute("PublishDate")