Problem going to last line of a huge Word document

W

wilson

I have a Word document over 1300 pages (> 70000 lines).
When I use Visual Basic code

Selection.GoTo What:=wdGoToLine, Which:=wdGoToLast

it does not go to the last line. It stops at page 600 around. But this
Visual Basic code works fine for most of the documents. Is there any
workarounds to get rid of this?

Thank you so much.
 
K

Klaus Linke

Selection.GoTo What:=wdGoToLine, Which:=wdGoToLast
[...]
It seems that it cannot go to > 32767 lines.


Hi Wilson,

I see this, too. You can use
Selection.EndKey Unit:=wdStory
or
Selection.Start=ActiveDocument.Content.End
or something like that as a work-around.

Most other "targets" for GoTo are limited to less that 2^15 anyway (max
16.379 bookmarks, 32.000 fields).
The VBA help says that Word uses a variant for the count, but probably it
really uses a signed integer (limited to +/- 32767) somewhere along the
way...

Regards,
Klaus
 
W

wilson

Agree. Seems many things relate to the magic number 32767.
Thanks for the work-arounds.

Klaus Linke said:
Selection.GoTo What:=wdGoToLine, Which:=wdGoToLast
[...]
It seems that it cannot go to > 32767 lines.


Hi Wilson,

I see this, too. You can use
Selection.EndKey Unit:=wdStory
or
Selection.Start=ActiveDocument.Content.End
or something like that as a work-around.

Most other "targets" for GoTo are limited to less that 2^15 anyway (max
16.379 bookmarks, 32.000 fields).
The VBA help says that Word uses a variant for the count, but probably it
really uses a signed integer (limited to +/- 32767) somewhere along the
way...

Regards,
Klaus
 

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