Microsoft Office Forums


Reply
Thread Tools Display Modes

Word FormField focus

 
 
wdVBANovice
Guest
Posts: n/a
 
      07-19-2008, 04:50 AM
Hi: I've created a Word (2002) document template with text formfields, and
have macros set to run on exit of various formfields.

Is it possible to set the focus (actually move the cursor) of the
ActiveDocument back to the formfield that the user just exited within the
macro that was called on exit?

All I can find are SetFocus methods for active x controls (not formfields),
and the "Select" method of the Formfields collection doesn't seem to do
anything?

 
Reply With Quote
 
 
 
 
Jay Freedman
Guest
Posts: n/a
 
      07-19-2008, 02:30 PM
On Fri, 18 Jul 2008 21:50:00 -0700, wdVBANovice
<(E-Mail Removed)> wrote:

> Hi: I've created a Word (2002) document template with text formfields, and
>have macros set to run on exit of various formfields.
>
>Is it possible to set the focus (actually move the cursor) of the
>ActiveDocument back to the formfield that the user just exited within the
>macro that was called on exit?
>
>All I can find are SetFocus methods for active x controls (not formfields),
>and the "Select" method of the Formfields collection doesn't seem to do
>anything?


This statement "should" work to reselect the field named Text2 from the exit
macro of the same field:

ActiveDocument.Bookmarks("Text2").Range.Fields(1). Result.Select

As explained in http://www.word.mvps.org/FAQs/TblsFl...ateFFields.htm,
though, there is a timing bug that needs to be worked around.

Also as mentioned there, it's a better idea to create a UserForm for data entry,
and transfer the final results to the document. That makes validation much
easier and has other advantages, too.

--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the newsgroup so all may benefit.
 
Reply With Quote
 
 
 
 
wdVBANovice
Guest
Posts: n/a
 
      07-19-2008, 03:08 PM
great thank you


"Jay Freedman" wrote:

> On Fri, 18 Jul 2008 21:50:00 -0700, wdVBANovice
> <(E-Mail Removed)> wrote:
>
> > Hi: I've created a Word (2002) document template with text formfields, and
> >have macros set to run on exit of various formfields.
> >
> >Is it possible to set the focus (actually move the cursor) of the
> >ActiveDocument back to the formfield that the user just exited within the
> >macro that was called on exit?
> >
> >All I can find are SetFocus methods for active x controls (not formfields),
> >and the "Select" method of the Formfields collection doesn't seem to do
> >anything?

>
> This statement "should" work to reselect the field named Text2 from the exit
> macro of the same field:
>
> ActiveDocument.Bookmarks("Text2").Range.Fields(1). Result.Select
>
> As explained in http://www.word.mvps.org/FAQs/TblsFl...ateFFields.htm,
> though, there is a timing bug that needs to be worked around.
>
> Also as mentioned there, it's a better idea to create a UserForm for data entry,
> and transfer the final results to the document. That makes validation much
> easier and has other advantages, too.
>
> --
> Regards,
> Jay Freedman
> Microsoft Word MVP FAQ: http://word.mvps.org
> Email cannot be acknowledged; please post all follow-ups to the newsgroup so all may benefit.
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Syntax for referring to a Me.FormField w/ "FormField" code generat Leo Access VBA Modules 3 10-20-2007 03:23 PM
Syntax for referring to a Me.FormField w/ "FormField" code generat Leo Access VBA Modules 0 10-20-2007 03:47 AM
Jump from FormField to FormField Thomas M Word VBA 2 11-15-2005 07:37 AM
Formfield to Formfield Micheline Word Tables 3 09-21-2004 04:07 PM
Which formfield has the focus Peter Lingo Word VBA 7 08-27-2004 02:40 PM


All times are GMT. The time now is 03:11 AM.
Microsoft Office Forums is not affiliated with Microsoft Corporation.


Welcome!
Welcome to the Microsoft Office Forums
 


Latest Threads
Mail Merging Content With High Quality
oleander (04-17-2014, 11:59 PM)

Aargh. What is this?
PeteJ (04-17-2014, 12:10 PM)

Word 2013 Insert Symbol (Not Responding)
tpthrshr (04-17-2014, 02:49 AM)

Can't save a large Word document
Josh (04-17-2014, 01:03 AM)

Remote help?
newman200 (04-13-2014, 12:54 PM)