Changing Field code of current header

A

andreas

Dear Experts:

With the cursor residing in some section of my document, I would like
to perform the following:

Access the ODD page and EVEN page header of that section and change
the field code {REF bookmark_DE \h} to {REF bookmark_EN \h} using
VBA.

I hope this is feasible.

Thank you very much in advance.

Regards, Andreas
 
T

Tony Jollans

You can probably tidy this up or be more specific in what you do based on
your own circumstances, but the general approach would be ...

For Each F in
Selection.Sections(1).Headers(wdHeaderFooterPrimary).Range.Fields
If f.Code.Text = "REF bookmark_DE \h" Then F.Code.Text = "REF
bookmark_EN \h"
Next

and the same for ...Headers(wdHeaderFooterEvenPages)...
 
A

andreas

You can probably tidy this up or be more specific in what you do based on
your own circumstances, but the general approach would be ...

For Each F in
Selection.Sections(1).Headers(wdHeaderFooterPrimary).Range.Fields
    If f.Code.Text = "REF bookmark_DE \h" Then F.Code.Text = "REF
bookmark_EN \h"
Next

and the same for ...Headers(wdHeaderFooterEvenPages)...

--
Enjoy,
Tony

 www.WordArticles.com











- Zitierten Text anzeigen -

Hi Tony,

ok, thank you very much for your great help. It works as desired.

Regards, Andreas
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top