Invalid object type; Menu control required (Error 427)

The first argument for the PopupMenu method must be a Menu control. This error has the following cause and solution: