Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / January 2008

Tip: Looking for answers? Try searching our database.

go to last page of the document  -word 2003

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
MEME - 02 Jan 2008 01:30 GMT
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
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.