userform information in header and footer

G

Guest

Hi

I have a userform setup in a template. When i open the template the
userform will open and i enter the information into the form, the information
is then transfered to the word document in the appropriate places by using
bookmarks.

Is it possible to automatically update the header with the information
transfered to the document. The bookmark i would like to use is called
title. I have been trying to use {Ref title} but i can't get this to work
and i have also tried the {styleref title} but i can't get this to work
either.

Is it possible??

Thanks in advance

alison
 
J

Jay Freedman

There are several places where that kind of arrangement can go wrong.

First to clarify {Ref title} versus {StyleRef title} : The first will show
the contents of a bookmark named 'title', while the second will show the
most recent text formatted with a style named 'title'. It sounds like you're
trying to use bookmarks and not styles, so you do want a {Ref} field.

When the userform puts the information into the document, it's very easy to
mistakenly put the data next to the bookmark instead of inside it. The
bookmark remains empty, so the {Ref} field shows nothing. The recommended
method of getting the data inside the bookmark is explained at
http://www.word.mvps.org/FAQs/MacrosVBA/InsertingTextAtBookmark.htm.

Finally, fields -- especially those in headers and footers -- don't update
automatically when you change the thing the field refers to. Your code needs
to do that explicitly. The easiest way is to change the view to Print
Preview and back (assuming the "Update fields" option is checked in the
Tools > Options > Print dialog). An alternative method is to step through
all the StoryRanges in the document, calling .Fields.Update in each one.

If you need more help with this, please post in one of the
microsoft.word.vba newsgroups.

--
Regards,
Jay Freedman
Microsoft Word MVP
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.
 

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