Adding Text Form Fields to a Document Header

M

Michael Tear

I'm trying to add a text form field in a docuements header and it appears
that it cannot be done. True? If yes is there a useful alternative? I tried
using a textbox, but, it really dose not render correctly. Any ideas?

Thanks in advance for the help!
 
S

Stefan Blom

If you are saying that you want to *repeat* the contents of a text form
field in the header, format the field with a unique character style and
then insert a STYLEREF field in the header.

On the other hand, if you want an actual field to be located above the
top margin, use a frame to position it.

--
Stefan Blom
Microsoft Word MVP


in message
news:[email protected]...
 
B

Bear

Michael:

In Word 2000 the formfield buttons are disabled when I switch to Header and
Footer view. If I attempt to paste an already-created formfield into a
header, I get an informative message listing all the places in which I cannot
put a formfield.

I'm able to place an ActiveX control (from the Control Toolbox) into a header.

But I can't imagine why this would ever be a good idea. Really.

Can you say why you want to put a formfield into a header? I'm sure there's
a simple, direct way to accomplish your goal, if only you'd state your goal.

Bear
 
M

Michael Tear

My goal is to fill the text form field with information stored in a database.
I don't know what database platform would be used, another developer is
working on that piece. My goal is just to provide a predefined area on a word
doc for a developer to write some VB code to recognize the form field and
populate it with the data from the database.

I hope thats descriptive enough :)
 
B

Bear

Michael:

I think I understand. Here are two simpler ways to accomplish this.

Bookmarks: Create a piece of dummy text in the header, select it, click
Insert > Bookmark and enter a bookmark name (must be one contiguous string),
and then click Add.

Your programmer would access the text in that bookmark with a statement like

MsgBox ActiveDocument.Bookmarks("BearTest").Range.Text

There are methods for changing the content of the bookmark, and that's what
the programmer would use. It's in the VBA Help.

Document Properties: Use a built-in document property, or use the Custom tab
of the File > Properties dialog box to create a custom document property.
Make it Text type, enter a dummy initial value, and click Add.

In your header, click Insert > Field. In the Field Names list, select
DocProperty. Click Options, select your new custom property, then click Add
to Field. Click OK to close all the dialog boxes. Your programmer will set
the value of this document property, then update the fields in the headers
and footers.

MsgBox ActiveDocument.CustomDocumentProperties("BearTest").Value

Again, these objects and their properties and methods are in the VBA Help.
You can also check this list for examples of code that will update all fields
in all headers and footers for the document.

Bear
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top