S
Sol Apache
I have a macro that inserts at several bookmarks text of varying lengths
into a header:
ActiveDocument.Sections(1).Headers(wdHeaderFooterFirstPage).Range.Bookmarks(
4).Range.Bookmarks(1).Range.Text= ³5 Pall Mall London WC2N 5EG²
I have 53 different addresses. What I need to do is change the postcode
which is of varying lengths to a character style. When I used Selection
rather than .range this worked:
Selection.MoveLeftUnit:=wdCharacter,Count:=8, Extend:=wdExtend
Selection.Style = ActiveDocument.Styles (³LS Postcode in Header²)
But it doesn¹t when I use range to get to the header bookmarks. Instead it
changes the style of the last 8 letters of the first row of text in the main
body of the letter.
How can I get to the postcode in a header? I am open to other suggestions
for example doing a search for the actual postcode (Find ³WC2N 5EG²) as I
can build that into the macro, but I don¹t know how to tell VBA to do this
in a header.
Thanks for any help
Sol
into a header:
ActiveDocument.Sections(1).Headers(wdHeaderFooterFirstPage).Range.Bookmarks(
4).Range.Bookmarks(1).Range.Text= ³5 Pall Mall London WC2N 5EG²
I have 53 different addresses. What I need to do is change the postcode
which is of varying lengths to a character style. When I used Selection
rather than .range this worked:
Selection.MoveLeftUnit:=wdCharacter,Count:=8, Extend:=wdExtend
Selection.Style = ActiveDocument.Styles (³LS Postcode in Header²)
But it doesn¹t when I use range to get to the header bookmarks. Instead it
changes the style of the last 8 letters of the first row of text in the main
body of the letter.
How can I get to the postcode in a header? I am open to other suggestions
for example doing a search for the actual postcode (Find ³WC2N 5EG²) as I
can build that into the macro, but I don¹t know how to tell VBA to do this
in a header.
Thanks for any help
Sol