PDA

View Full Version : Properties Instead of Methods



Anne Troy
07-08-2004, 11:38 AM
Selection.EndKey Unit:=wdStory
Selection.EndKey Unit:=wdLine

are methods, rather than properties, which I am rather looking for. As such, they are instructions to go the end of line or end of document, rather than an information about where is the end of line or document. In fact, I would like to know whether or not my pointer is currently at the end of line or end of document. In this way, I will be able to stop the loop the pointer is engaged when it has reached the end of line or document. So if anyone knows, please reply !
Thanks !

That was the response I got to something I answered elsewhere. Can you help?

TonyJollans
07-08-2004, 12:25 PM
This is off the top of my head because I'm a bit busy with other things :)

The end of the document is uniquely identified by being the end of the Range which is the document. So end of document is ..


Selection.Document.range.end

And the end of the Selection is simply ..


Selection.End
They are both numbers - if they are the same you're at the end of the document.

Lines are slightly different - there is no Line Object but you can identify the end of the current line using the built-in bookmark ..


selection.Bookmarks("\Line").end

If the selection is collapsed (i.e. just an insertion point) all is well and you can compare it to the selection.end

BUT .. if the selection spreads over multiple lines the "\line bokmark returns the first line of the selection so some extra messing around would be needed in that case

fumei
07-14-2004, 11:57 PM
Can you repeat what it is you want to happen?

You wrote know if the current location is at the end of a line, or the end of the document. What if neither applies. The current location is in the middle of the line?

I am not sure what you want.

Anne Troy
07-17-2004, 05:19 PM
Hi, guys. :)
Thanks for your help.
Might as well *out* with it...it's here:
http://www.developerfusion.com/forums/topic-21762

Kelly
07-18-2004, 06:24 PM
I meant to reply to this a couple of days ago, and then I forgot.:cleverman

I had two ideas.

1. There is a property called Selection.IPAtEndOfLine that returns "true" or "false." Selection.IPAtEndOfLine will be true ONLY when the selection point is collapsed to an insertion point(cursor), and the point is at the end of a line.

2. My other thought was:

Assuming the Selection point is collapsed, then the following:



If Selection.Characters(1) = Chr(13) Then

would test to see if you are at the end of a "paragraph" - in other words, if you are right at the "invisible" carriage return character.

I suppose I could imagine good uses for either of these.

However, I just noticed that Dreaboat "outed" the original thread...:*)
So now, I will take a look at:
http://www.developerfusion.com/forums/topic-21762

maybe after I get a firm grasp of their discussion I will have more to add

-Kelly :dance:

Kelly
07-18-2004, 06:32 PM
Oh!

I just visited the "mirror" thread at developerfusion, and it appears that "Claudealie" came up with a good solution.

To get the current line number, the solution was:

Selection.Range.Information(wdFirstCharacterLineNumber)

That works great.

However, I guess that is a different action than determining if you are at the end of the line.

Since the original question was to find a 'property' that would be roughly equivalent to the "Selection.EndKey Unit:=wdLine" method, then I guess I stand by my earlier proposal of Selection.IPAtEndOfLine or testing for Chr(13)

TonyJollans
07-19-2004, 03:26 AM
Nice, Kelly, I didn't know that.