共用方式為


Office) (CustomXMLParts.SelectByNamespace 方法

會選取命名空間符合搜尋準則的自訂 XML 組件集合。

語法

運算式SelectByNamespace (NamespaceURI)

表達 會傳回 CustomXMLParts 物件的 運算式。

參數

名稱 必要/選用 資料類型 描述
NamespaceURI 必要 String 含有命名空間 URI。

傳回值

CustomXMLParts

註解

如果具有此命名空間沒有自訂 XML 組件存在,此方法會傳回空的 CustomXMLParts 集合物件。

範例

下列範例會選取所有符合命名空間的自訂 XML 元件,然後從符合 XPath 運算式的元件中選取節點。

Dim cxp1 As CustomXMLParts 
Dim cxn As CustomXMLNode 
 
' Returns all of the custom xml parts with the given namespace. 
 Set cxp1 = ActiveDocument.CustomXMLParts.SelectByNamespace("urn:invoice:namespace")    
 
' Get the node matching the XPath expression.                              
Set cxn = cxp1(1).SelectSingleNode("//*[@supplierID = 1]") 

另請參閱

支援和意見反應

有關於 Office VBA 或這份文件的問題或意見反應嗎? 如需取得支援服務並提供意見反應的相關指導,請參閱 Office VBA 支援與意見反應