Check the mouse Position

T

Thejan Mendis

Hi

How do I check whether mouse point in
* begin of the line
* begin of the paragraph
* and end od aboves

Pls give me a sample cord for check these in word macro.

THEJAN
 
J

Jonathan West

If you mean the mouse pointer, then there is no way within VBA of doing
this. If you mean the cursor (selection point) then you can do this.

Try this

Function AtStartOfPara() as Boolean
AtStartOfPara = (Selection.Start = Selection.Paragraphs(1).Range.Start)
End Function

Function AtEndOfPara() As Boolean
AtEndOfPara = (Selection.End + 1 = Selection.Paragraphs(1).Range.End)
End Function

Function AtStartOfLine() As Boolean
AtStartOfLine = (Selection.Start = _
ActiveDocument.Bookmarks("\Line").Range.Start)
End If

There's no point in having a function for being at the end of a line,
because the end of a line is the start of the next line.

--
Regards
Jonathan West - Word MVP
MultiLinker - Automated generation of hyperlinks in Word
Conversion to PDF & HTML
http://www.multilinker.com
 
B

Bob S

There's no point in having a function for being at the end of a line,
because the end of a line is the start of the next line.

Not if the end of the line is also the end of a paragraph?

Bob S
 

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