Hi,
I'm trying to program a macro. One of the steps is to go to end of document
and change the header.
I'm unable to find the command (or write the program) to go to last page of
the document. (I don't have number of pages neither bookmarks)
Thanks

Signature
meme
Helmut Weber - 02 Jan 2008 01:58 GMT
Hi,
a *heading* does not belong to a page,
but to a section. In that section,
it may belong to odd pages or even pages
or to the first page of the section explicitly.
Your question is meaningless insofar,
as the change of a heading does not
require to move the selection.
Anyway,
Selection.ExtendMode = False
Selection.EndKey Unit:=wdStory
gets you to where you want.
What then?
--
Greetings from Bavaria, Germany
Helmut Weber, MVP WordVBA
Vista Small Business, Office XP
fumei - 02 Jan 2008 20:59 GMT
What then indeed?
The header shown on the last page may be set pages and pages prior to that.
Doug Robbins - Word MVP - 03 Jan 2008 08:47 GMT
The following will replace the contents of the Header in the last section of
the document:
With ActiveDocument
.Sections(.Sections.Count).Headers(wdHeaderFooterPrimary).Range = "Some
new text"
End With

Signature
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
> Hi,
>
[quoted text clipped - 7 lines]
>
> Thanks