Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / March 2008

Tip: Looking for answers? Try searching our database.

Populating data into headers or footers

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
DevalilaJohn - 22 Mar 2008 00:55 GMT
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
Doug Robbins - Word MVP - 22 Mar 2008 23:08 GMT
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.

Signature

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

>I have a macro that takes data from a user form, as part of a letterhead
>and
[quoted text clipped - 9 lines]
>
> John
DevalilaJohn - 23 Mar 2008 21:44 GMT
Doug,

That's spot on, thanks for the help.

> Instead of using bookmarks, have the code in your user form set the values
> of document variables
[quoted text clipped - 27 lines]
> >
> > John

Rate this thread:






 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.