Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / September 2007

Tip: Looking for answers? Try searching our database.

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

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
OTWarrior - 31 Aug 2007 14:42 GMT
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?
Graham Mayor - 31 Aug 2007 15:14 GMT
It appears you are trying to validate form fields - see
http://www.gmayor.com/formfieldmacros.htm

Signature

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

My web site www.gmayor.com
Word MVP web site http://word.mvps.org
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>

> 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
[quoted text clipped - 30 lines]
>
> What am I doing wrong?
OTWarrior - 31 Aug 2007 15:50 GMT
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 :)

> It appears you are trying to validate form fields - see
> http://www.gmayor.com/formfieldmacros.htm
Graham Mayor - 01 Sep 2007 06:53 GMT
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.

Signature

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

My web site www.gmayor.com
Word MVP web site http://word.mvps.org
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>

> 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
[quoted text clipped - 12 lines]
>> Word MVP web site http://word.mvps.org
>> <>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.