BookMark in Header

S

Staceman

Is it possible to reference a Bookmark in a header?

I am creating a contract with a Fill In Form that will open automatically
via AutoNew, the user will fill in the blanks and click OK. Word will
populate the information throughout the document for the user. We need a
contract number to be placed in the header bc it needs to be on every page.

Any ideas?
 
Å

Åsa Holmgren

Yes, thats possible, just go ahead ;-)

ActiveDocument.Bookmarks("MyBookmark").Range = "My contract number"

/Asa
 
S

Staceman

I have not been able to do it that way. I have a Bookmark named
bkContractNum and a {Ref bkContractNum} in the header, as well as one in the
body to troubleshoot. When I create a new document, my fill in form comes
up, I enter the Contract Number, click OK and the macro fills in the Ref in
the body, but not the header. I have been reading (via Google) that Word
won't allow this when a doc is protected. I guess I should ask a couple of
quick questions:
1) Should I be using a Bookmark or a FormField?
2) Does a form have to be protected to allow an omline form to work with a
Fill In form?
3) When in the Header, it will not allow you to enter a Text Form Field, is
there a way to do it in the body and then paste it into the Header?
 
D

Doug Robbins

Yes, the form does need to be protected for the formfields to work. Run a
macro containing the following code on exit from the formfield to get the
cross reference in the header to update:

With ActiveDocument
.Unprotect
.Sections(1).Headers(wdHeaderFooterPrimary).Range.Fields.Update
.Protect wdAllowOnlyFormFields, NoReset
End With


--
Please respond to the Newsgroup for the benefit of others who may be
interested. Questions sent directly to me will only be answered on a paid
consulting basis.

Hope this helps,
Doug Robbins - Word MVP
 

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