I have a macro that deletes all shapes with a certain
name. Then, to all existing headers I should be able to
attach a new shape... but there I'm stuck (see last piece
of code). Can anyone help how to cycle through the
headers ?


Selection.GoTo What:=wdGoToSection, Which:=wdGoToFirst,
Count:=1, Name:=""
ActiveWindow.ActivePane.View.SeekView =
wdSeekCurrentPageHeader

' Delete all shapes with name "TMP_"
For Each oShape In Selection.HeaderFooter.Shapes
If InStr(oShape.Name, "TMP_") <> 0 Then oShape.Delete
Next oShape

' Go to first page and activate header
' --> How can I do this for ALL existing headers ?
Selection.HeaderFooter.Shapes.AddTextbox
(msoTextOrientationHorizontal, 368.85, 36#, 144#,
36#).Select

Re: Adding a TextBox to each header by Word

Word
Mon Nov 10 01:23:59 CST 2003

G'day "Peter Ryckaert" <anonymous@discussions.microsoft.com>,

don't use the active view - its a nightmare and slow

use ActiveDocument.StoryRanges
or even ActiveDocument.Sections(1).Headers

etc

My Word VBA Spellbook goes into this in some detail if required.


"Peter Ryckaert" <anonymous@discussions.microsoft.com> was spinning
this yarn:

>I have a macro that deletes all shapes with a certain
>name. Then, to all existing headers I should be able to
>attach a new shape... but there I'm stuck (see last piece
>of code). Can anyone help how to cycle through the
>headers ?
>
>
>Selection.GoTo What:=wdGoToSection, Which:=wdGoToFirst,
>Count:=1, Name:=""
>ActiveWindow.ActivePane.View.SeekView =
>wdSeekCurrentPageHeader
>
>' Delete all shapes with name "TMP_"
>For Each oShape In Selection.HeaderFooter.Shapes
> If InStr(oShape.Name, "TMP_") <> 0 Then oShape.Delete
>Next oShape
>
>' Go to first page and activate header
>' --> How can I do this for ALL existing headers ?
>Selection.HeaderFooter.Shapes.AddTextbox
>(msoTextOrientationHorizontal, 368.85, 36#, 144#,
>36#).Select

Steve Hudson

Word Heretic, Sydney, Australia
Tricky stuff with Word or words for you.
wordheretic.com

Replies offlist may require payment.

Re: Adding a TextBox to each header by scorpion53061

scorpion53061
Tue Nov 25 20:00:13 CST 2003

Hi,

Please post a amazon link to your book if there is one.

Thanks.

"Word Heretic" <word_heretic@yahoo.com.au> wrote in message
news:s6fuqvojjd1l5s1n0th7uuqai8tm1m4mq8@4ax.com...
> G'day "Peter Ryckaert" <anonymous@discussions.microsoft.com>,
>
> don't use the active view - its a nightmare and slow
>
> use ActiveDocument.StoryRanges
> or even ActiveDocument.Sections(1).Headers
>
> etc
>
> My Word VBA Spellbook goes into this in some detail if required.
>
>
> "Peter Ryckaert" <anonymous@discussions.microsoft.com> was spinning
> this yarn:
>
> >I have a macro that deletes all shapes with a certain
> >name. Then, to all existing headers I should be able to
> >attach a new shape... but there I'm stuck (see last piece
> >of code). Can anyone help how to cycle through the
> >headers ?
> >
> >
> >Selection.GoTo What:=wdGoToSection, Which:=wdGoToFirst,
> >Count:=1, Name:=""
> >ActiveWindow.ActivePane.View.SeekView =
> >wdSeekCurrentPageHeader
> >
> >' Delete all shapes with name "TMP_"
> >For Each oShape In Selection.HeaderFooter.Shapes
> > If InStr(oShape.Name, "TMP_") <> 0 Then oShape.Delete
> >Next oShape
> >
> >' Go to first page and activate header
> >' --> How can I do this for ALL existing headers ?
> >Selection.HeaderFooter.Shapes.AddTextbox
> >(msoTextOrientationHorizontal, 368.85, 36#, 144#,
> >36#).Select
>
> Steve Hudson
>
> Word Heretic, Sydney, Australia
> Tricky stuff with Word or words for you.
> wordheretic.com
>
> Replies offlist may require payment.



Re: Adding a TextBox to each header by Word

Word
Fri Nov 28 23:53:51 CST 2003

G'day "scorpion53061" <scorpion_53061nospamhereplease@yahoo.com>,

There aint. There are WIPs (Work In Progress). Lot of info, not
finished. Some patches have 'fixed' some doc'd probs.


"scorpion53061" <scorpion_53061nospamhereplease@yahoo.com> was
spinning this yarn:

>Hi,
>
>Please post a amazon link to your book if there is one.
>
>Thanks.
>
>"Word Heretic" <word_heretic@yahoo.com.au> wrote in message
>news:s6fuqvojjd1l5s1n0th7uuqai8tm1m4mq8@4ax.com...
>> G'day "Peter Ryckaert" <anonymous@discussions.microsoft.com>,
>>
>> don't use the active view - its a nightmare and slow
>>
>> use ActiveDocument.StoryRanges
>> or even ActiveDocument.Sections(1).Headers
>>
>> etc
>>
>> My Word VBA Spellbook goes into this in some detail if required.
>>
>>
>> "Peter Ryckaert" <anonymous@discussions.microsoft.com> was spinning
>> this yarn:
>>
>> >I have a macro that deletes all shapes with a certain
>> >name. Then, to all existing headers I should be able to
>> >attach a new shape... but there I'm stuck (see last piece
>> >of code). Can anyone help how to cycle through the
>> >headers ?
>> >
>> >
>> >Selection.GoTo What:=wdGoToSection, Which:=wdGoToFirst,
>> >Count:=1, Name:=""
>> >ActiveWindow.ActivePane.View.SeekView =
>> >wdSeekCurrentPageHeader
>> >
>> >' Delete all shapes with name "TMP_"
>> >For Each oShape In Selection.HeaderFooter.Shapes
>> > If InStr(oShape.Name, "TMP_") <> 0 Then oShape.Delete
>> >Next oShape
>> >
>> >' Go to first page and activate header
>> >' --> How can I do this for ALL existing headers ?
>> >Selection.HeaderFooter.Shapes.AddTextbox
>> >(msoTextOrientationHorizontal, 368.85, 36#, 144#,
>> >36#).Select
>>
>> Steve Hudson
>>
>> Word Heretic, Sydney, Australia
>> Tricky stuff with Word or words for you.
>> wordheretic.com
>>
>> Replies offlist may require payment.
>

Steve Hudson

Word Heretic, Sydney, Australia
Tricky stuff with Word or words for you.
wordheretic.com

If my answers r 2 terse, ask again or hassle an MVP,
at least they get recognition for it then.
Lengthy replies offlist require payment.