Propiedad XMLNode.BaseName (Word)

Devuelve una cadena que representa el nombre del elemento sin ningún prefijo.

Sintaxis

expresión. BaseName

expresión obligatoria. Variable que representa un objeto 'XMLNode'.

Ejemplo

En el siguiente ejemplo, se agrega el atributo author al elemento book en el documento activo y, a continuación, se establece el valor del atributo.

Sub AddIDAttribute() 
 Dim objElement As XMLNode 
 Dim objAttribute As XMLNode 
 
 For Each objElement In ActiveDocument.XMLNodes 
 If objElement.NodeType = wdXMLNodeElement Then 
 If objElement.BaseName = "book" Then 
 
 Set objAttribute = objElement.Attributes _ 
 .Add("author", objElement.NamespaceURI) 
 
 objAttribute.NodeValue = "David Barber" 
 
 Exit For 
 End If 
 End If 
 Next 
End Sub

Vea también

Objeto XMLNode

Soporte técnico y comentarios

¿Tiene preguntas o comentarios sobre VBA para Office o esta documentación? Vea Soporte técnico y comentarios sobre VBA para Office para obtener ayuda sobre las formas en las que puede recibir soporte técnico y enviar comentarios.