ShowPopupMenu Function

Syntax:

ShowPopupMenu(StrArray$( )[, PopupStyle][, XPos, YPos])

Group: User Input

Description:
Show a popup menu and return the number of the item selected. The item number is the index of the StrArray selected minus LBound(StrArray). The value -1 is returned in no menu item is selected.

Parameter Description

StrArray$( ) This one-dimensional array of strings establishes the list of choices. All the non-null elements of the array are used.

PopupMenuStyle This controls how the popup menu is aligned. Any combination of styles may used together. See the table below.

XPos When the menu is put up the alignment will be at this window position. If this is omitted then the current mouse position is used.

YPos When the menu is put up the alignment will be at this window position. If this is omitted then the current mouse position is used.

PopupStyle Value Effect

Example:

Sub Main
  Dim Items(0 To 2) As String
  Items(0) = "Item &1"
  Items(1) = "Item &2"
  Items(2) = "Item &3"
  X = ShowPopupMenu(Items) ' show popup menu
  Debug.Print X ' item selected
End
Sub