Populating data into headers or footers

D

DevalilaJohn

I have a macro that takes data from a user form, as part of a letterhead and
populates the date, addressee, etc. into the letter. I do this via bookmarks
in the document. I also want to populate some of the data into the footer on
the second page.

Any suggestions on how to do it would be greatly appreciated.

TIA,

John
 
D

Doug Robbins - Word MVP

Instead of using bookmarks, have the code in your user form set the values
of document variables

With ActiveDocument
.Variables("varname1").Value = somecontrolname1.Value
.Variables("varname2").Value = somecontrolname2.Value
'etc
.PrintPreview
.ClosePrintPreview
End With

then in the document, insert DOCVARIABLE fields at the locations that you
want the data to appear.

The PrintPreview/ClosePrintPreview is the lazy man's way of getting all of
the fields in the document to update so that each DOCVARIABLE field shows
the value that has been assigned to the associated variable.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 
D

DevalilaJohn

Doug,

That's spot on, thanks for the help.

Doug Robbins - Word MVP said:
Instead of using bookmarks, have the code in your user form set the values
of document variables

With ActiveDocument
.Variables("varname1").Value = somecontrolname1.Value
.Variables("varname2").Value = somecontrolname2.Value
'etc
.PrintPreview
.ClosePrintPreview
End With

then in the document, insert DOCVARIABLE fields at the locations that you
want the data to appear.

The PrintPreview/ClosePrintPreview is the lazy man's way of getting all of
the fields in the document to update so that each DOCVARIABLE field shows
the value that has been assigned to the associated variable.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

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