Form Question -

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I need to create an "account profile" form where the first page (account #1)
has fields to enter the required information (account name, etc.) and some
fields will be drop-down lists. When I have finished filling in the
information for account #1, I need to do a page break and then have the same
form ready to be filled in for account #2. One document needs to be ready to
handle 10 or more account profiles (1 to a page).

This needs to be done in Word or Excel only, unfortunately no Access :-(
Any ideas are greatly appreciated!
 
I would suggest creating a one page form with a "Post" (or Save or something
like that) button on the bottom of the page. That button then writes the
field values to a data file and puts the focus back on the first page.

OR

Create a form in VBA within Word/Excel and have the form post the
information back into the document/spreadsheet.

Bob Tulk
MOUS(XP/97)
 
Hi =?Utf-8?B?TG9yaU0=?=,
I need to create an "account profile" form where the first page (account #1)
has fields to enter the required information (account name, etc.) and some
fields will be drop-down lists. When I have finished filling in the
information for account #1, I need to do a page break and then have the same
form ready to be filled in for account #2. One document needs to be ready to
handle 10 or more account profiles (1 to a page).

This needs to be done in Word or Excel only, unfortunately no Access :-(
Generally, I'd
- set up the entire form and test it, until I know it's perfect
- insert a page break at the top
- select all and create an AutoText entry, SAVED IN THE TEMPLATE for this
form (not in Normal.dot)
- remove the pagebreak and protect the form
- now you need a macro that unprotects the form, inserts the AutoText entry
at the end of the document, then reprotects the form without losing user input.
Roughly, it would look like this:

Sub InsertAutoTextInForm()
Dim doc As Word.Document
Dim rng As Word.Range

Set doc = ActiveDocument
Set rng = doc.Range
rng.Collapse wdCollapseEnd
If doc.ProtectionType <> wdNoProtection Then
doc.Unprotect
End If
doc.AttachedTemplate.AutoTextEntries( _
"NameOfEntry").Insert rng, True
doc.Protect wdAllowOnlyFormFields, True
End Sub

You'd need to substitute the name of your AutoText entry for NameOfEntry,
above.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or reply
in the newsgroup and not by e-mail :-)
 
Note that if you have any Ref or calculation fields that rely on your
formfields they will be changed when you insert the AutoText entry which
will redefine the bookmarks. If this is the case, you may need to select
your entire document (or at least the current page) and either lock or
unlink the fields. (This would be done while the document is unprotected.)

The following amendment does this (but unlinks all fields in the body of the
document). The poster may need something that only targets particular fields
but this is quick and dirty and works. It is only necessary if the
information in a form field is used in another field.

Sub InsertAutoTextInForm()
Dim doc As Word.Document
Dim rng As Word.Range

Set doc = ActiveDocument
Set rng = doc.Range
rng.Collapse wdCollapseEnd
If doc.ProtectionType <> wdNoProtection Then
doc.Unprotect
End If
doc.Fields.Unlink
doc.AttachedTemplate.AutoTextEntries( _
"ATTest").Insert rng, True
doc.Protect wdAllowOnlyFormFields, True
End Sub

The following macro updates only Ref fields. It could be called by the
insertion module prior to insertion of the AutoText and the command could be
changed to unlink.

Sub RefFieldUpdateAllStory()
' Written by Charles Kyle Kenyon 15 November 2001
' All Story Field Updater - Ref fields
Dim oField As Field
Dim oStory As Range
On Error Resume Next
For Each oStory In ActiveDocument.StoryRanges
' This goes into headers and footers as well as the regular document
For Each oField In ActiveDocument.Range.Fields
If oField.Type = wdFieldRef Then
oField.Update
End If
Next oField
Next oStory
End Sub

If a different kind of field is being used to reflect the data in the
formfields, that field type could be specified instead. I guess one other
change I would make to your (excellent) recommendations would be to change
the paragraph formatting of the first paragraph of the AutoText entry to
page break before rather than inserting a manual page break.

This may be more than the original poster needs or wants. If so, I
apologize.
--

Charles Kenyon

Word New User FAQ & Web Directory: http://addbalance.com/word

Intermediate User's Guide to Microsoft Word (supplemented version of
Microsoft's Legal Users' Guide) http://addbalance.com/usersguide

See also the MVP FAQ: http://www.mvps.org/word which is awesome!
--------- --------- --------- --------- --------- ---------
This message is posted to a newsgroup. Please post replies
and questions to the newsgroup so that others can learn
from my ignorance and your wisdom.
 
Thanks so much to all of you for your help. I ended up creating it in Excel.
I appreciate all your comments!
 
Back
Top