Knowing the location of the cursor

S

S Shulman

Hi

I can I know when the cursor is in the begining of the first line of the
page?

(I am merging documents and I want to insert a page break only if the cursor
is not in the beginning of a blank page otherwise I will have a blank page
between the 2 merged documents)

Thanks in advance,
Samuel
 
J

Jezebel

You can use the Information() function, looking at the physical position of
the selection, or checking if the page number of the selection is greater
than the page number of the preceding character. The second approach might
be simpler to code: the vertical position functions rely on the actual
display of the document; while you could track the page number entirely by
reference to Ranges without using the Selection at all, which is always
better coding.

Alternatively, make sure each added document begins with a heading with a
style set for 'Page break before' -- Word won't insert an additional page if
the heading is already at the start of a page.
 
J

Jonathan West

Hi Samuel

If Selection.Start = ActiveDocument.Bookmarks("\Page").Range.Start Then
'cursor is at start of page
Else
'It isn't
End If
 

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