Prev: Increasing brightness of all pictures by 10%
Next: Create INI file; save to user selected location
From: Angie M. on 20 Nov 2009 11:54 Hi, I'm trying to do something simple and have tried code snips from other answers on this site but can't seem to make it work without errors. Our footers already contain a document name in 8pt font. I need to create a macro that will go into the footer, create a new paragraph at the beginning of the footer and center a page number in Times New Roman 12 pt font. So you end up with the page number centered on the first line and then the document name on the 2nd line, left aligned with an 8pt font. If the document has a different first page footer I do not want thte page number on the first page, only the primary footer. Using the existing "page number" style for formatting will work fine. Here's what I have at this point after trying lots of things: Dim myrange As Range Set myrange = ActiveDocument.Sections(1).Footers(wdHeaderFooterPrimary) myrange.InsertParagraphBefore I've also tried working with the collapse method and pressing Enter for the blank line with no luck. Thanks for any help.
From: Angie M. on 20 Nov 2009 11:58 Sorry forgot to add that I do have the page numbering piece which is: Selection.Sections(1).Footers(1).PageNumbers.Add PageNumberAlignment:= _ wdAlignPageNumberCenter, firstPage:=False
From: Doug Robbins - Word MVP on 20 Nov 2009 17:08 Use: Dim frange As Range Set frange = ActiveDocument.Sections(1).Footers(wdHeaderFooterPrimary).Range frange.InsertBefore vbCr frange.Collapse wdCollapseStart ActiveDocument.Fields.Add frange, wdFieldEmpty, "Page" With frange.Paragraphs(1) .Alignment = wdAlignParagraphCenter With .Range.Font .Name = "Times New Roman" .Size = 12 End With End With -- Hope this helps. Please reply to the newsgroup unless you wish to avail yourself of my services on a paid consulting basis. Doug Robbins - Word MVP, originally posted via msnews.microsoft.com "Angie M." <AngieM(a)discussions.microsoft.com> wrote in message news:2B12AEA0-977D-48FE-B6B7-858D35215E89(a)microsoft.com... > Hi, > > I'm trying to do something simple and have tried code snips from other > answers on this site but can't seem to make it work without errors. > > Our footers already contain a document name in 8pt font. I need to create > a > macro that will go into the footer, create a new paragraph at the > beginning > of the footer and center a page number in Times New Roman 12 pt font. So > you > end up with the page number centered on the first line and then the > document > name on the 2nd line, left aligned with an 8pt font. If the document has > a > different first page footer I do not want thte page number on the first > page, > only the primary footer. Using the existing "page number" style for > formatting will work fine. > > Here's what I have at this point after trying lots of things: > > Dim myrange As Range > Set myrange = ActiveDocument.Sections(1).Footers(wdHeaderFooterPrimary) > myrange.InsertParagraphBefore > > I've also tried working with the collapse method and pressing Enter for > the > blank line with no luck. > > Thanks for any help.
From: Angie M. on 20 Nov 2009 17:10 Disregard this question, I found my answer, thanks "Angie M." wrote: > Sorry forgot to add that I do have the page numbering piece which is: > > Selection.Sections(1).Footers(1).PageNumbers.Add PageNumberAlignment:= _ > wdAlignPageNumberCenter, firstPage:=False >
|
Pages: 1 Prev: Increasing brightness of all pictures by 10% Next: Create INI file; save to user selected location |