excel - VBA; Multiple footer and header allignment, How can I allgine left Center and right footer? -
i know there codes like:
activedocument.sections(i).footers(wdheaderfooterprimary).range .text = myfootervalue1 .paragraphformat.alignment = wdalignpagenumberleft .font.size = 10 'size 10 font end
but want add, left (company name) right (date) , middle page number.
you can tabstops.
you need work out width of page (minus margins), add center , right tabstop , separate values tabs.
sub insertfooters() dim pagewidth double, section section each section in activedocument.sections section.pagesetup pagewidth = (.pagewidth) - .leftmargin - .rightmargin end section.footers(wdheaderfooterprimary).range .text = "left" & vbtab & "center" & vbtab & "right" .paragraphformat .tabstops.clearall .tabstops.add pagewidth / 2, alignment:=wdalignmenttabalignment.wdcenter .tabstops.add pagewidth, alignment:=wdalignmenttabalignment.wdright end .font.size = 10 end next end sub
Comments
Post a Comment