共用方式為


Visio (的 Windows.ItemEx 屬性)

會傳回集合中的 Window 物件。 唯讀。

語法

expressionItemEx( _CaptionOrIndex_ )

表達 代表 Windows 物件的變數。

參數

名稱 必要/選用 資料類型 描述
CaptionOrIndex 必要 Variant 包含要擷取之視窗的標題或索引。 如需詳細資訊,請參閱<註解>。

傳回值

視窗

註解

ItemEx 屬性套用於 Windows 集合時,與 Item 屬性類似,因為第一個引數可以是視窗的標題或索引。 從 Microsoft Office Visio 2003 開始,所有內建的多文檔介面 (MDI) 視窗都有唯一的標題,但不保證子視窗具有唯一的標題。 如果有多個子視窗具有相同的標題,則 ItemEx 會傳回具有最小索引值的子視窗。

範例

下列的 Microsoft Visual Basic for Applications (VBA) 巨集會示範如何使用 ItemEx 屬性使視窗成為 Visio 內使用中的視窗。 該屬性會將文件新增到 Documents 集合,從而建立新視窗。 然後,它會取得新視窗 (的索引編號,這等於) 的視窗專案計數、使用該索引編號來取得新視窗的標題,然後將標題傳遞至 ItemEx 屬性以啟用新視窗。

Sub ItemEx_Example() 
 
 Dim intWindowCount As Integer 
 Dim strWindowCaption As String 
 
 'Add a document not based on a template to the collection 
 Application.Documents.Add ("") 
 
 'Get the index number in the Windows collection of the new window 
 intWindowCount = Application.Windows.Count 
 
 'Get the new window's caption 
 strWindowCaption = Application.Windows(intWindowCount) 
 
 'Activate the new window 
 Application.Windows.ItemEx(strWindowCaption).Activate 
 
End Sub

支援和意見反應

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