ItemEx Property [Visio 2003 SDK Documentation]
Returns a Window object from a collection.
objRet = object**.ItemEx**(CaptionOrIndex)**
objRet The Window object retrieved from the collection.
object Required. An expression that returns a Windows collection.
CaptionOrIndex Required Variant. Contains the caption or index of the window to retrieve. See Remarks for details.
Version added
2003
Remarks
The ItemEx property is similar to the Item property as it applies to the Windows collection, except that the first argument can be either the window caption or the index. Beginning with Microsoft Office Visio 2003, all built-in Multiple Document Interface (MDI) windows have unique captions, although there is no guarantee that subwindows have unique captions. If there are multiple subwindows that have the same caption, ItemEx returns the one that has the lowest index.
Example
This Microsoft Visual Basic for Applications (VBA) macro shows how to use the ItemEx property to make a window active in Visio. It adds a document to the Documents collection, thereby creating a new window. Then it gets the index number of the new window (which is equal to the count of window items), uses that index number to get the new window's caption, and then passes the caption to the ItemEx property to activate the new window.
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
Applies to | Windows collection
See Also | Item property