VBA - footer

j4ymf

Well-known Member
Joined
Apr 28, 2003
Messages
776
Office Version
  1. 365
Platform
  1. Windows
Hello

We use this VBA code in our footer where it exports to a word document, but is there a way i can add a page number aswell?

VBA Code:
    ' Add text to footer in left-aligned
    footerText = " Company info "

    ' Add footer to the document
    With wddoc.Sections(1).Footers(1).Range ' wdHeaderFooterPrimary = 1
        .Text = footerText
        .ParagraphFormat.Alignment = wdAlignParagraphLeft ' Left-align the footer
        .Font.Name = "Century Gothic"
        .Font.Size = 10
        .Font.Color = RGB(56, 56, 56) ' Dark grey/black color
        ' Removed the left indent for no spacing
        .ParagraphFormat.SpaceAfter = 1 ' No space after the footer
        .ParagraphFormat.SpaceBefore = 0 ' No space before the footer
    End With
 
I would like to say a big thank to you both Tetra201 / Macropod for your support over the festive period both replys worked fantastic.

keep up the good work, your support helps us all.
 
Upvote 0

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
@j4ymf - I have removed the solution mark from your feedback post.
Please either mark the most useful answer as the solution, or if you formed your own solution by using multiple answers, then post it and and mark your own final solution. This way, it will help future readers to get to the answer quickly.
 
Upvote 0

Forum statistics

Threads
1,225,346
Messages
6,184,400
Members
453,230
Latest member
ProdInventory

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top