Creating Footers

P

Peter Newman

Im creatiing a word doc from vb6. Im struggling with the footer as im trying to create the followin

' Company Name' Left Aligne
' Page n of n ' Centere
'Issued & Date' Right Aligne

The footers need to be in font Times New Roman, size 7 Itali

Can anybody give me any example code to look at
 
J

Jonathan West

Hi Peter

Make this easier on yourself by ensuring that the Footer style in the
document has tabs defined so that you have a center-aligned tab at the
middle of the page and a right aligned tab set at the right margin. Also see
to it that the font of the Footer style is as per your requirements. To have
control over your layout, you should be defining your own template on which
your reports are based, and the Footer style can be defined within that
termplate

Then you make sure that the page footer is styled using the Footer style.
Then you insert into the footer the company name, a tab character, the page
numbers, another tab, then the issue & date. All will be in the correct
places.
 
P

Peter Newman

Johathan

Thanks for the pointers, Do you know of any sample code i can look at. Im newish to this. Currently using VB6 application, im creating the word doc from scratch each time its needed, and theres not a lot of documentation around for newbies like me to look at in regards to setting up footers.
 
J

Jonathan West

Peter Newman said:
Johathan,

Thanks for the pointers, Do you know of any sample code i can look at. Im
newish to this. Currently using VB6 application, im creating the word doc
from scratch each time its needed, and theres not a lot of documentation
around for newbies like me to look at in regards to setting up footers.

Don't use VBA to set up the format of the footer. Get the template defined
by hand from within Word. You only need to do it once. Then all you need to
is insert the text each time you create your report.

In fact, you could put the page number and the date into the template itself
using fields to save yourself the bother of coding that part. Similarly, I
don't suppose the Company name is going to change from report to report, so
you can preset that as well. That just leaves "Issued".

If you want help on setting up the template, take a look at these two
articles

Creating a Template – The Basics (Part I)
http://word.mvps.org/FAQs/Customization/CreateATemplatePart1.htm

Creating a Template (Part II)
http://word.mvps.org/FAQs/Customization/CreateATemplatePart2.htm

If you want to just put a word or phrase into a predefien location, you can
set a bookmark at that location, and then use the InsertAfter method to put
text there. For instance, if you have defined a bookmark called "Issued",
then the following line of code would do the needful, where objWord is the
name of the Word application object you have defined for controlling Word

objWord.ActiveDocument.Bookmarks("Issued").Range.InsertAfter "Your text goes
here"

It doesn't matter where the bookmark is, the text will go in after it.
 

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