go to last page of the document -word 2003

M

MEME

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
 
H

Helmut Weber

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
 
F

fumei via OfficeKB.com

What then indeed?

The header shown on the last page may be set pages and pages prior to that.
 
D

Doug Robbins - Word MVP

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


--
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
 

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