[Last Call] Learn how to a build a cloud-first strategyRegister Now


Word forms

Posted on 2011-10-19
Medium Priority
Last Modified: 2012-05-12
I really need some help here.

I need to create a form as per attachment and I'm having the following problems

1. Each time I enter data in a first field, it moves the adjacent field
2. I need the Enter key to behave like a Tab
3. I need a button that will email this form on completion.


Question by:Bianchi928
  • 3
  • 3

Expert Comment

ID: 36998484
Is this what you want?

Made it into a template so you can use it as a real form. To edit, right click and say open.

To go to next field, Enter
To make a new line in a field, Shift+Enter



Expert Comment

ID: 36998519
*please note macros will need to be enabled for this to work as requested.

Word has an inbuilt Send To mail function (eg located in file menu in word 2003). If you really want a button, need to know what version of Word your using as the methods can be slightly different.
LVL 76

Expert Comment

ID: 36998551
Question 1
The document that you have posted looks like one to be printed as a blank for filling in by hand.

To create a Word document form, you need to use Form Fields. When designing a Word document form, show the Forms toolbar. It would also help to show formatting characters - the Show/Hide button (¶) button  will toggle their display.

I have copied the first few lines of the document and shown how to use form fields, tab stops and tab leaders as an attempt to recreate the original. The document is forms-protected, but without a password.

Question 2
This is not possible with Word document. The enter key is used to create a new paragraph.  If you need fuller windows form  interactivity, you could consider capturing the data on a VBA userform, and copying the data on to the document.
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

LVL 76

Expert Comment

ID: 36998567
Question 3
This is another subject. There is a mail item in the File menu. If this is not sufficient I suggest that you raise a separate question. It will require a non-trivial amount of VBA.
LVL 76

Expert Comment

ID: 36998631
To question 2, I should have said that it isn't possible without VBA.

In the interest of this site's philosophy as a how-to site as opposed to a do-it-for-you site, SPC_75's document shows how by using some VBA code. I will leave it  to the SPC_75 to post the code in a snippet.

Accepted Solution

SPC_75 earned 1500 total points
ID: 36998710
Thanks Graham.

1. The moving fields can be solved by proper formatting, in this case I used columns (see example document) though tab stops work just as well (many ways to skin a cat).

2.The code for VBA to change enter key functionality can be found here: http://support.microsoft.com/default.aspx?scid=kb;en-us;211219 
(or by pressing Alt+F11 in the example document I posted.)

Sub EnterKeyMacro()
' Check whether the document is protected for forms
' and whether the protection is active.
   If ActiveDocument.ProtectionType = wdAllowOnlyFormFields And _
   Selection.Sections(1).ProtectedForForms = True Then
      ' Retrieve the bookmark of the current selection.
      ' This is equivalent to the name of the form field.
      myformfield = Selection.Bookmarks(1).Name
      ' Go to the next form field if the current form field
      ' is not the last one in the document.
      If ActiveDocument.FormFields(myformfield).Name <> _
      ActiveDocument.FormFields(ActiveDocument.FormFields.Count) _
      .Name Then
         ' If the current form field is the last one,
         ' go to the first form field in the document.
      End If
   ' If the document is not protected for forms,
   ' insert a tab stop character.
      Selection.TypeText Chr(13)
   End If
End Sub

Sub AutoNew()
 ' Do Not protect the template containing these macros.
   CustomizationContext = ActiveDocument.AttachedTemplate
   ' Bind the ENTER key to the EnterKeyMacro.
   KeyBindings.Add KeyCode:=BuildKeyCode(wdKeyReturn), _
   KeyCategory:=wdKeyCategoryMacro, Command:="EnterKeyMacro"
   ' Reprotect the document with Forms protection.
   ActiveDocument.Protect Type:=wdAllowOnlyFormFields, NoReset:=True
End Sub
Sub AutoOpen()
' This macro will reassign the ENTER key when you open an existing
' Word form fields document.
   CustomizationContext = ActiveDocument.AttachedTemplate
   ' Bind the Enter key to the EnterKeyMacro.
   KeyBindings.Add KeyCode:=BuildKeyCode(wdKeyReturn), _
   KeyCategory:=wdKeyCategoryMacro, Command:="EnterKeyMacro"
End Sub
Sub AutoClose()
   CustomizationContext = ActiveDocument.AttachedTemplate
   ' Disables prompt to save template changes.
End Sub

Open in new window


Author Closing Comment

ID: 37014954
Wasn't a complete solution to my request.

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article shows how to get a list of available printers for display in a drop-down list, and then to use the selected printer to print an Access report or a Word document filled with Access data, using different syntax as needed for working with …
Lost Word File? Eagerly, need it back? Read ahead; this File Recovery guide is for you.
This video teaches the viewer how to align pictures around text while keeping the text properly aligned in the document.
This Micro Tutorial well show you how to find and replace special characters in Microsoft Word. This is similar to carriage returns to convert columns of values from Microsoft Excel into comma separated lists.
Suggested Courses

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question