How to get current line value ?

M

moonhkt

Hi All

How to get current line value ? Using 2003 coding.

Before using
WordBasic.StartOfLine
WordBasic.LineDown 1, 1 'Select current line
inputLine$ = UCase(WordBasic.[Selection$]())


moonhkt
 
D

Doug Robbins - Word MVP

Not sure what you are really after, but

Selection.Bookmarks("\line").Range.Text

will return the text of the line in which the selection is located.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 
M

moonhkt

Not sure what you are really after, but

Selection.Bookmarks("\line").Range.Text

will return the text of the line in which the selection is located.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP




How to get current line value ? Using 2003 coding.
Before using
WordBasic.StartOfLine
WordBasic.LineDown 1, 1 'Select current line
inputLine$ = UCase(WordBasic.[Selection$]())
moonhkt- ÁôÂóQ¤Þ¥Î¤å¦r -

- Åã¥Ü³Q¤Þ¥Î¤å¦r -

Thank. But the soluation is not.
e.g. If the cursor at line 9 , the text in line 9 "Hello This is line
9". I want return "Hello This is line 9" string.

In Word Basic , the coding as below. Now, I want VBA coding.

WordBasic.StartOfLine
WordBasic.LineDown 1, 1 'Select current line
inputLine$ = UCase(WordBasic.[Selection$]())
 
D

Doug Robbins - Word MVP

That is exactly what the code that I gave you will do.

Try

MsgBox Selection.Bookmarks("\line").Range.Text

If the cursor is in a line that contains the text "Hello This is line 9" a
message box will be displayed that contains:

"Hello This is line 9"

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

Not sure what you are really after, but

Selection.Bookmarks("\line").Range.Text

will return the text of the line in which the selection is located.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP




How to get current line value ? Using 2003 coding.
Before using
WordBasic.StartOfLine
WordBasic.LineDown 1, 1 'Select current line
inputLine$ = UCase(WordBasic.[Selection$]())
moonhkt- ÁôÂóQ¤Þ¥Î¤å¦r -

- Åã¥Ü³Q¤Þ¥Î¤å¦r -

Thank. But the soluation is not.
e.g. If the cursor at line 9 , the text in line 9 "Hello This is line
9". I want return "Hello This is line 9" string.

In Word Basic , the coding as below. Now, I want VBA coding.

WordBasic.StartOfLine
WordBasic.LineDown 1, 1 'Select current line
inputLine$ = UCase(WordBasic.[Selection$]())
 

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