![]() |
|
#1
|
||||
|
||||
![]()
OK. The default footer has tabs at the centre and right so the simplest approach is to use that and add two tabs and the text to the end of the range e.g.
Code:
Sub AddFooterWithPageNumber() Dim oSection As section Dim oFooter As HeaderFooter Dim oRng As Range ' Loop through each section in the document For Each oSection In ActiveDocument.Sections oSection.PageSetup.FooterDistance = CentimetersToPoints(1) For Each oFooter In oSection.Footers If oFooter.Exists Then Set oRng = oFooter.Range ' Set font properties With oRng.Font .Name = "Times New Roman" .Size = 14 End With oRng.Fields.Add oRng, wdFieldPage, , False oRng.Collapse wdCollapseEnd oRng.Text = Chr(9) & Chr(9) & "laith" End If Next oFooter Next oSection lbl_Exit: Set oSection = Nothing Set oFooter = Nothing Set oRng = Nothing End Sub
__________________
Graham Mayor - MS MVP (Word) (2002-2019) Visit my web site for more programming tips and ready made processes www.gmayor.com |
#2
|
|||
|
|||
![]() Quote:
It works perfectly ![]() Best Regards |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
nyconfidential | Word VBA | 1 | 08-13-2022 03:37 PM |
![]() |
dw85745 | Word | 3 | 01-16-2022 03:19 PM |
Don't want page number or date in footer on first page, do want graphic in header. | dianahbr | Word | 2 | 02-23-2018 09:25 AM |
![]() |
thefonebug | Word | 12 | 10-24-2016 05:18 AM |
![]() |
mmathisekar | Word | 11 | 06-16-2016 06:00 AM |