Home > Software engineering >  Vba to Word page layout in different chapters, consult each great god
Vba to Word page layout in different chapters, consult each great god

Time:11-15

Document section has three points, but I refer to some code to write the following code can not realize the online page layout with three section respectively, consult everybody how to modify the great god,
Sub page encoding ()
Dim mrange As Word. Range
Dim r1 As Range, r2 As Range, r3 As Range
The Set r1=mrange. Sections (1). Footers (wdHeaderFooterPrimary). The Range
Set r2=mrange. Sections (2). The Footers (wdHeaderFooterPrimary). The Range
Set r3=mrange. Sections (3). The Footers (wdHeaderFooterPrimary). The Range
With r1
, the Font Size=10.5
. The Collapse direction:=wdCollapseEnd
. Fields. The Add Range:=r1, Type:=wdFieldEmpty, Text:=_
"Arabic PAGE \ *", PreserveFormatting:=True
. Expand the unit:=wdSection
. ParagraphFormat. Alignment=wdAlignParagraphCenter
End With

With r2
, the Font Size=10.5
. The Collapse direction:=wdCollapseEnd
. Fields. The Add Range:=r1, Type:=wdFieldEmpty, Text:=_
"Arabic PAGE \ *", PreserveFormatting:=True
. Expand the unit:=wdSection
. ParagraphFormat. Alignment=wdAlignParagraphCenter

End With

With r3
, the Font Size=10.5
. The Collapse direction:=wdCollapseEnd
. Fields. The Add Range:=r1, Type:=wdFieldEmpty, Text:=_
"Arabic PAGE \ *", PreserveFormatting:=True
. Expand the unit:=wdSection
. ParagraphFormat. Alignment=wdAlignParagraphCenter

End With
End sub


Please the great god of action

CodePudding user response:

Now can only achieve the page number from the first page layout to the last page, but the other section of the chapter need manual operation can be rearranged,
  •  Tags:  
  • VBA
  • Related