Reselect the drop down box on exit macro when not tabbed out of

O

OTWarrior

I have a protected document that uses drop down form fields, and on exit I
want the form field to be reselected if a certain value is selected.

I am using this code for another area to get the name, but i haven't been
able to use it as a selection

If Selection.FormFields.Count = 1 Then 'No textbox but a check- or listbox
BKMname2 = Selection.FormFields(1).Name
ElseIf Selection.FormFields.Count = 0 And Selection.Bookmarks.Count > 0 Then
BKMname2 = Selection.Bookmarks(Selection.Bookmarks.Count).Name
End If

I have tried:

ActiveDocument.FormFields(BKMname2).Range.Select

Selection.GoTo What:=wdGoToBookmark, Name:=BKMname2

ActiveDocument.Bookmarks(BKMname2).Range.Fields(1).Result.Select

....And none of these seem to select the bookmark.

I can make it reselect the drop down menu when tab is pressed, that is not a
problme as i simply use:
SendKeys "{LEFT}"
SendKeys "%{DOWN}"

however the people using this form may not always use the tab key, or at all,
and i just want to cover myself, otherwise I will be bombarded by calls.

What am I doing wrong?
 
O

OTWarrior

That is almost there, but unfortunately it still goes to the box you click
on, rather than back to the original box (despite the msgbox appearing
telling you you can't move on)

Thank you for the help, it is a step in the right direction :)
 
G

Graham Mayor

If you apply the macros to all the fields, you cannot move out of any field
(with tab or mouse) until the field is filled.

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top