vba - Assign even odd page numbers in word -
i trying write vba macro word, document have page numbers, alignment of odd page number different page. code presently trying changing alignment of both odd , pages,which 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 activedocument.sections(i).footers(1).pagenumbers .numberstyle = wdpagenumberstylearabic .headinglevelforchapter = 0 .includechapternumber = false .chapterpageseparator = wdseparatorhyphen .restartnumberingatsection = false .startingnumber = starts .add (0) end 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
it seems odd , pages don't set left
, right
positions of page numbers need set outside
, inside
positions of them.
so, try change tiny line:
.add (0)
into 1 of possible 'odd-even' positions:
.add wdalignpagenumberoutside .add wdalignpagenumberinside
moreover, last line trying insert 'tab' not necessary then.
Comments
Post a Comment