Positioning a summary at the top of a document

C

Carole

I use a userform to create a document summary at the top
of my document. I use the following code to get to the
beginning of my document before creating the summary.

Selection.GoTo What:=wdGoToPage, Which:=wdGoToNext,
Name:="1"

It works for the majority of users (or the majority of the
documents - not quite sure) but for some of the users, the
summary ends up in the middle of the document.

1. Do you have a better command line I can use to make
sure that the summary always ends up at the top of the
document and not in the middle?

2. Can you tell from this little bit of information why
this is happening?

Thank you in advance.

Carole
 
J

Jean-Guy Marcil

Hi Carole,

Selection.GoTo What:=wdGoToPage, Which:=wdGoToNext, _
Name:="1"
will take you to the first page of the document only if the page numbering
scheme is standard, i.e. the first physical page is numbered "1", and so on.
If the numbering has been changed, let's say to make room for an
introduction where the first 3 pages are numbered i, ii, iii and the fourth
numbered 1, then that code will take you to the fourth page (whose name is
"1", as per the requirement in the code!).
In this numbering example, you would have to use
Selection.GoTo What:=wdGoToPage, Which:=wdGoToNext, _
Name:="i"
to get to the absolute firs physical page.

Instead, try:
Selection.GoTo What:=wdGoToPage, Which:=wdGoToFirst
or
Selection.HomeKey wdStory
which will never fail you, regardless of the page numbering format or
scheme.

HTH

--
Cheers!
_______________________________________
Jean-Guy Marcil - Word MVP
(e-mail address removed)
Word MVP site: http://www.word.mvps.org
 
J

Jay Freedman

Hi, Carole,

Use this command instead:

Selection.HomeKey Unit:=wdStory

I'm not sure what the problem with GoTo is, but I've never liked it anyway.
:)
 
D

Doug Robbins - Word MVP - DELETE UPPERCASE CHARACT

Hi Carole,

Better to use

ActiveDocument.Range.InsertBefore [yoursummary]

--
Please post any further questions or followup to the newsgroups for the
benefit of others who may be interested. Unsolicited questions forwarded
directly to me will only be answered on a paid consulting basis.
Hope this helps
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