PopUpMenu doesn't work inside Microsoft Word 5.1 (and possibly other Microsoft applications) because Word doesn't use the standard Macintosh pop up menus. The people at Microsoft like to do everything in their very own, very special, very incompatible way.

If you really have to automate pop up menus in Word, you'll have to use the new Drag extension (which simulates a real mouse drag). This is not an easy task, since you have to find the coordinates of the initial and final locations of the mouse drag. Here's an example that shows how to save a Word file in a specific format by choosing an item from the pop up menu in the "Save asÉ" dialog:

SwitchApp "Word" partial
Menu "File" "Save asÉ"
WaitWindow dialog
MoveWindow top
Drag from 120 200 to 0 48 relative window slower
Button "Desktop"
Type "My File In Other Format"
Wait 6
Key enter

The "MoveWindow top" command is needed because we want the pop up menu to be drawn below the pop up menu rectangle; if the window is too close to the bottom of the screen, the menu doesn't fit below the rectangle so Word draws it above. We could also drag the mouse upwards, but we have to know for sure whether the menu will be drawn above or below.

The Drag command works as follows: 120 and 200 are the horizontal and vertical coordinates of a point inside the pop up menu rectangle, where the dragging starts. 0 and 48 are the horizontal and vertical offsets from the initial position (they are treated as offsets because of the "relative" keyword); if each line of the pop up menu takes 16 pixels vertically, then "0 48" means "move to the third item of the pop up menu". The "window" keyword makes the Drag command treat all coordinates as window coordinates (instead of screen coordinates). The "slower" keyword slows down the mouse drag; this is needed because Word takes some time to respond to the user action, so the pop up menu selection doesn't change if the drag is too fast.

For the technically inclined: Word never calls PopUpMenuSelect. Instead, it handles pop up menus with a custom CDEF that does all the drawing and mouse tracking by itself.