#1
|
|||
|
|||
Is it possible to not select all text upon entering a form field?
I am creating a document in Word for Mac 2011 that contains multiple form fields. Whenever I tab into a form field, all of the text in that field is automatically selected, which makes it very easy to accidentally overwrite with a single keystroke.
Is there are way to make it so that all of the text is not automatically selected, but so that the cursor is either at the end of the text in the form field or to have the cursor wherever it was when the user was last in that particular form field? Some googling has led me to believe that changing the EnterFieldBehavior property may be the answer, but I have no idea how to edit this property. http://office.microsoft.com/en-us/wo...080607616.aspx Any help is appreciated. |
#2
|
||||
|
||||
Hi pruppert,
You could only change that behaviour by using an 'On Entry' macro attached to the formfield. This means, of course, that anyone using the form would need to allow macros to run when they open the document. Although some users may do this automatically, others may have their systems configured to automatically disable all macros. As well, some Word versions (notably Mac Word 2008 and the Word Starter edition) don't support macros, so an 'On Entry' macro wouldn't help those users either. The EnterFieldBehavior Property applies to a userform, not to formfields.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#3
|
|||
|
|||
Hi. Thank you for the reply.
I am the only person who would be using the form, so the issue of allowing the macro is not a problem. I don't have any experience with writing macros, but have a very basic understanding of programming and have dabbled in Applescript. Could you or someone point me in the directions of resources that would show how to write such a macro? Thanks. |
#4
|
||||
|
||||
Hi pruppert,
In your unprotected document, press Cmd-F11 (I think) to access the vba editor. On the left side of the screen you'll see a project with your document's name. Expand that so you can see a module named 'ThisDocument'. Double-click on 'ThisDocument', then enter the following code on the main panel: Code:
Sub Collapse() Selection.Collapse End Sub
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#5
|
|||
|
|||
Thanks for the help. This is close to what I want, but I would like the cursor to default to the end of the selection. The macros you give puts the cursor at the beginning of the text in the form field.
|
#6
|
|||
|
|||
Nevermind. Figured it out. I just changed "Collapse" to "MoveRight".
Thank again for your help! Phil |
#7
|
||||
|
||||
Actually, you'd normally use:
Code:
Sub Collapse() Selection.Collapse wdCollapseEnd End Sub
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Macro to find text and replace with form field containing that text | iiiiifffff | Word VBA | 16 | 06-04-2016 01:47 AM |
Form Fields - Create blank form text field with if statement? | LAssist2011 | Word | 5 | 12-14-2011 03:02 PM |
Large amount of text as a form field. | JustK | Word | 2 | 11-15-2011 11:17 AM |
Creating a form to select text. | ravanelli | Word | 1 | 05-20-2011 06:05 PM |
Treating a text box like a form Text Field | jackaroo | Word | 0 | 08-18-2010 10:20 AM |