Link to home
Start Free TrialLog in
Avatar of mte01
mte01Flag for Lebanon

asked on

word report add page number and change text font

hi guys,
im generating a word report, what i need is to put the page number and a small text on each page footer, can this be done. like the text on the left and the page number on the left.
and i need to change the font of a specific section or text in the report, is that dooable?
thanks
ASKER CERTIFIED SOLUTION
Avatar of omegaomega
omegaomega
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of mte01

ASKER

hi, thanks for the help it's working but i just to need to set the location of these things, i need them to be something like that:

          bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla
          bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla
          bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla



Here is some footer text                                                                                                      page 1 of 1


what i meant is to have the text on the left and the page number on the right section of the document.
thanks again for the help
Hello, mte01,

There are many possible ways to do this.  Typically the footer defaults to having a center-tab in the middle and a right-tab on the right.  If this is the case for your report, then you could do this:

        Const wdFieldNumPages As Integer = 26
        Const wdFieldPage As Integer = 33

        Dim docNew As New Word.Document
        Dim rngFooter As Word.Range
        rngFooter = docNew.Sections.Item(1).Footers.Item(1).Range

        rngFooter.Fields.Add(Range:=rngFooter, Type:=wdFieldNumPages)
        rngFooter.Collapse()
        rngFooter.Text = " of "
        rngFooter.Collapse()
        rngFooter.Fields.Add(Range:=rngFooter, Type:=wdFieldPage)
        rngFooter.Collapse()
        rngFooter.Text = "Here is some Text" & vbTab & vbTab & "Page "

If the tabstops in the footer are different than normal you would need to modify them before using the above (or modify the above as necessary).

Cheers,
Randy
Avatar of mte01

ASKER

thanks for the help, it's working now,
do u have a tutorial on how to build word document and things like that? coz i cant find any
Hello, mte01,

No, I'm sorry I don't have a good reference for this.  I don't normally do a lot of work with Word.

A general technique that I have often found helpful is to record a Word macro while I manually perform the steps required.  The VBA in the macro produced is typically not directly useful, but can give some good clues about the properties and methods that can be used.  

Cheers,
Randy
Avatar of mte01

ASKER

>>omegaomega

Can you please provide help in this: http:Q_21837643.html