From: LA Lawyer on 22 Mar 2010 19:21 I want to select everything (text and possibly even a text box) in a header. How do I do that?
From: Doug Robbins - Word MVP on 22 Mar 2010 18:48 ActiveDocument.Sections(1).Headers(wdHeaderFooterPrimary).Range.Select should do it as using ActiveDocument.Sections(1).Headers(wdHeaderFooterPrimary).Range.Delete deletes everything, including a text box in the header. -- 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 "LA Lawyer" <hkapp(a)kapplaw.com> wrote in message news:#TYkT4gyKHA.5940(a)TK2MSFTNGP02.phx.gbl... > I want to select everything (text and possibly even a text box) in a > header. How do I do that? >
From: Graham Mayor on 23 Mar 2010 02:49 There are three headers (and three footers) associated with each section in the document. Which header do you have in mind and what do you want to do with the header having selected it? The following will address all the headers in the document and assign them in turn to the range named oRng. If you want to be more selected you can add extra code to do that. Dim oSection As Section Dim oHeader As HeaderFooter Dim oRng As Range For Each oSection In ActiveDocument.Sections For Each oHeader In oSection.Headers Set oRng = oHeader.Range 'do what you want with oRng (the header) here e.g. oRng.Delete Next oHeader Next oSection -- <>>< ><<> ><<> <>>< ><<> <>>< <>><<> Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org <>>< ><<> ><<> <>>< ><<> <>>< <>><<> "LA Lawyer" <hkapp(a)kapplaw.com> wrote in message news:%23TYkT4gyKHA.5940(a)TK2MSFTNGP02.phx.gbl... >I want to select everything (text and possibly even a text box) in a >header. How do I do that? >
|
Pages: 1 Prev: Importing/parsing data from an external file in Word 2007 Macr Next: word and reports |