I have the following code executed in a macro button:
Sub SelectUA set s = ActiveDocument.Fields("UA").GetPossibleValues for i=0 to s.Count-1 m = s.Item(i).Text ActiveDocument.Fields("UA").Select m ActiveDocument.GetApplication.Refresh ActiveDocument.GetApplication.WaitForIdle tp = ActiveDocument.GetApplication.MsgBox (m,1) if tp = 1 then exit for end if next ActiveDocument.Fields("UA").Clear end sub
the problem is that the MsgBox function allways return a 0 (OK or CANCEL pressed) so the Sub executes until the end of the for loop.