Access/VBA Library

Find Method

Searches the windowlist for the the item which matches the given pattern and returns its position in the windowlist. When no item has been found, zero is returned.

See also:


ActiveWindowList.Find( Pattern [, StartAtIndex] )
Name Type Description
ActiveWindowList   The name of an object of type ActiveWindowList
Pattern String Required. The pattern to which the windowname is matched with. You can use the patterns of the Like operator.
StartAtIndex Long Optional. The index in the windowlist to start the search from.
Default: 1
  ' Find the first Notepad window and activate it
  Dim WindowList As New ActiveWindowList
  Dim Index As Long

  Index = WindowList.Find("*Notepad*")

  If Index Then
      ' Activate the Window
      WindowList.Activate Index
  End If