does header exist?

R

Robert

I am working on a Fax template that has Bookmarks and Headers.
Header on first page is different.

Page two – if needed – has a bookmark in the header. It’s content must
be copied from a bookmark on page one.

What code do I need to check if page 2 or header 2 exists? I guess
calling a header or bookmark that does not exist will result in error.

TIA - Robert
 
J

Jonathan West

Hi Robert,

If you have a different first pahe header, then the second page header will
exist even if there is no second page. All that happens is that is isn't
displayed!

So, I would recommend that you place a Ref field in the non-first-page
header which points to the bookmark on page 1, which i presume you can rely
on to be present. The header on page 2 will then be correctly displayed if
the document is long enough to display it.
 
R

Robert

Jonathan said:
Hi Robert,

If you have a different first pahe header, then the second page header will
exist even if there is no second page. All that happens is that is isn't
displayed!

So, I would recommend that you place a Ref field in the non-first-page
header which points to the bookmark on page 1, which i presume you can rely
on to be present. The header on page 2 will then be correctly displayed if
the document is long enough to display it.
Hi Jonathan,

must be doing something wrong.. This is what I do:

In a UserForm this code:

ActiveDocument.Bookmarks("bkName").Select
Selection.TypeText "any text"

And as a result the Bookmark (to which the REF field refers) disappears...

As you figured out I want "any text" in the Header on the first page
and if page 2 exists copy that from the Bookmark.

Thanks - Robert
 
J

Jonathan West

Robert said:
Hi Jonathan,

must be doing something wrong.. This is what I do:

In a UserForm this code:

ActiveDocument.Bookmarks("bkName").Select
Selection.TypeText "any text"

And as a result the Bookmark (to which the REF field refers) disappears...

As you figured out I want "any text" in the Header on the first page
and if page 2 exists copy that from the Bookmark.

Hi Robert,

You need the following article

Inserting text at a bookmark without deleting the bookmark
http://word.mvps.org/FAQs/MacrosVBA/InsertingTextAtBookmark.htm
 

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