how to insert a form field into a header

R

Regina Gorenshteyn

Hi,

I am trying to create a macro that, among other things,
will insert some text into a header. Unfortunately, Word
won't let me put Forms fields into my header. I was just
wondering if anyone know how to circumvent this problem.

I know that, theoretically, it is possible to have a
bookmark inside a header because I am using another macro
(created by someone else, who I have no contact with) that
does just that. I tried starting my macro's Word doc from
a copy of this macro's Word doc hoping the header will
keep it's form fields, but it didn't.

I hope this is not too confusing. I have never worked with
macros or Visual Basic before and wil appreciate any help.

Thanks,
-Regina
 
D

Doug Robbins - Word MVP

Hi Regina,

I am not sure where you are getting the text from, but I would create a
document variable to hold the text and then have a { DOCVARIABLE } field in
the header

ActiveDocument.Variables("varname").Value = "your text"
ActiveDocument.Fields.Update

creates the variable and places "your text" into it

and { DOCVARIABLE "varname" ) will return "your text" in the document at the
location of the field.

Please respond to the newsgroups for the benefit of others who may be
interested.

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