Page Number of Displayed (not Selected) Page 
Author Message
 Page Number of Displayed (not Selected) Page

Hi

is there any syntax to obtain the page number of the CURRENTLY DISPLAYED
text in document. Thus for example, the selected part may be page 1, but the
scroll bars be used to display page 4 without selecting it.

Any help gratefully received

Tim



Sun, 27 Mar 2005 05:15:54 GMT  
 Page Number of Displayed (not Selected) Page
Hi Tim,

I've poked around a little more and I've come up with a solution that's
imperfect:

MsgBox (ActiveWindow.VerticalPercentScrolled / 100) * _
    Selection.Information(wdNumberOfPagesInDocument) + 1

Here's how it's imperfect. Sometimes, I get results like the following:
1.95
Scroll down by one click and get the next result
 2

For both, however, the statusbar indicates that I'm on
Page 1         Sec 1         1/5

HTH


Quote:
> Hi

> is there any syntax to obtain the page number of the CURRENTLY DISPLAYED
> text in document. Thus for example, the selected part may be page 1, but
the
> scroll bars be used to display page 4 without selecting it.

> Any help gratefully received

> Tim



Mon, 28 Mar 2005 02:48:42 GMT  
 Page Number of Displayed (not Selected) Page
Dave

but that's just the ticket!! (I think)

I only need it to warn users when the active page is not the visible page -
it certainly produced a sensible result when I tested it.

MANY THANKS

Tim


Quote:
> Hi Tim,

> I've poked around a little more and I've come up with a solution that's
> imperfect:

> MsgBox (ActiveWindow.VerticalPercentScrolled / 100) * _
>     Selection.Information(wdNumberOfPagesInDocument) + 1

> Here's how it's imperfect. Sometimes, I get results like the following:
> 1.95
> Scroll down by one click and get the next result
>  2

> For both, however, the statusbar indicates that I'm on
> Page 1         Sec 1         1/5

> HTH



> > Hi

> > is there any syntax to obtain the page number of the CURRENTLY DISPLAYED
> > text in document. Thus for example, the selected part may be page 1, but
> the
> > scroll bars be used to display page 4 without selecting it.

> > Any help gratefully received

> > Tim



Mon, 28 Mar 2005 05:36:29 GMT  
 Page Number of Displayed (not Selected) Page
If that's all you need, then you can use the following

If Selection.Information(wdHorizontalPositionRelativeToPage) = -1 Then
    'Cursor is not on screen
End If

--
Regards
Jonathan West - Word MVP
MultiLinker - Automated generation of hyperlinks in Word
Conversion to PDF & HTML
http://www.multilinker.com
Word FAQs at http://www.multilinker.com/wordfaq
Please post any follow-up in the newsgroup. I do not reply to Word questions
by email


Quote:
> Dave

> but that's just the ticket!! (I think)

> I only need it to warn users when the active page is not the visible
page -
> it certainly produced a sensible result when I tested it.

> MANY THANKS

> Tim



> > Hi Tim,

> > I've poked around a little more and I've come up with a solution that's
> > imperfect:

> > MsgBox (ActiveWindow.VerticalPercentScrolled / 100) * _
> >     Selection.Information(wdNumberOfPagesInDocument) + 1

> > Here's how it's imperfect. Sometimes, I get results like the following:
> > 1.95
> > Scroll down by one click and get the next result
> >  2

> > For both, however, the statusbar indicates that I'm on
> > Page 1         Sec 1         1/5

> > HTH



> > > Hi

> > > is there any syntax to obtain the page number of the CURRENTLY
DISPLAYED
> > > text in document. Thus for example, the selected part may be page 1,
but
> > the
> > > scroll bars be used to display page 4 without selecting it.

> > > Any help gratefully received

> > > Tim



Mon, 28 Mar 2005 06:07:38 GMT  
 Page Number of Displayed (not Selected) Page
Jonathan

that's really neat, too

final request: pl can you give me the code to select the first paragraph on
the screen, please

Tim



Mon, 28 Mar 2005 15:29:17 GMT  
 Page Number of Displayed (not Selected) Page

Tim,

How about:

   Selection.MoveUp wdWindow, 1
   Selection.Paragraphs(1).Range.Select

Note this may select a paragraph that is only *partially* shown.  
If you need the first paragraph that BEGINS on the screen, that'll
be a bit more involved.

--

Reply **ONLY** to the newsgroup.  Note: MVPs do not work for Microsoft.
MVP FAQ: http://www.mvps.org/word
Userforms demystified: http://www.speakeasy.org/~mtangard/userforms.html
"Life is nothing if you're not obsessed." --John Waters

Quote:

> Jonathan

> that's really neat, too

> final request: pl can you give me the code to select the first paragraph on
> the screen, please

> Tim



Mon, 28 Mar 2005 16:33:21 GMT  
 Page Number of Displayed (not Selected) Page


Quote:

> Tim,

> How about:

>    Selection.MoveUp wdWindow, 1
>    Selection.Paragraphs(1).Range.Select

> Note this may select a paragraph that is only *partially* shown.
> If you need the first paragraph that BEGINS on the screen, that'll
> be a bit more involved.

Note also that this only works where the selection is already visible.

--
Regards
Jonathan West - Word MVP
MultiLinker - Automated generation of hyperlinks in Word
Conversion to PDF & HTML
http://www.multilinker.com
Word FAQs at http://www.multilinker.com/wordfaq
Please post any follow-up in the newsgroup. I do not reply to Word questions
by email



Mon, 28 Mar 2005 17:01:45 GMT  
 
 [ 7 post ] 

 Relevant Pages 

1. Word not printing total number of pages in page footer correctly

2. Page numbering and fit to page in Excel from VB

3. Next page section break with continuous page numbering

4. Page Numbering In Unusual Spot on Page

5. Paging a database with page number buttons?

6. Common Dialog (Print) doesn't display Page Number selection

7. Report displayed using Crystal ActiveX viewer shows blank pages after scroll to last page

8. Crystal - Displaying Total Number of Pages to be Printed

9. Selecting Page Numbers

10. Crystal - Displaying Total Number of Pages to be Printed

11. Display the recordset page by page

12. Document does not retain page numbers

 

 
Powered by phpBB® Forum Software