I am trying to write a vba macro for word, where the document will have page numbers, but the alignment of odd page number will be different from the even page. The code that I am presently trying is changing the alignment of both the odd and even pages,which is not desired
ActiveDocument.Sections(i).PageSetup.OddAndEvenPagesHeaderFooter = False
ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageFooter
Selection.HeaderFooter.LinkToPrevious = Not Selection.HeaderFooter.LinkToPrevious
ActiveDocument.Sections(i).Footers(wdHeaderFooterPrimary).LinkToPrevious = False
With ActiveDocument.Sections(i).Footers(1).PageNumbers
.NumberStyle = wdPageNumberStyleArabic
.HeadingLevelForChapter = 0
.IncludeChapterNumber = False
.ChapterPageSeparator = wdSeparatorHyphen
.RestartNumberingAtSection = False
.StartingNumber = starts
.Add (0)
End With
End If
ActiveDocument.Sections(i).PageSetup.OddAndEvenPagesHeaderFooter = True
ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageFooter
ActiveDocument.Sections(i).Footers(wdHeaderFooterEvenPages).LinkToPrevious = False
WordBasic.InsertAlignmentTab Alignment:=2, Relative:=0, Leader:=0
no_format
variable here?? and other variables likestarts
,continue
,align
?? did you try to debug this code step-by-step?? Moreover, add bigger part of your code that would include opening forend if
statement which is in 5th row before end... - Kazimierz Jawor