Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.word.tables
|
|||
|
|||
Get current column/row index
I am writing a macro to enter text into a table. How can I get the current
column and row number where the cursor is in the table? thanks |
#2
Posted to microsoft.public.word.tables
|
|||
|
|||
Get current column/row index
dmpollock wrote:
I am writing a macro to enter text into a table. How can I get the current column and row number where the cursor is in the table? thanks Use the .Information property of the Selection object with the appropriate constants: Selection.Information(wdEndOfRangeColumnNumber) Selection.Information(wdEndOfRangeRowNumber) If the selection is extended and contains more than one cell, the numbers returned refer to the location of the end of the selection. If you think that might be the situation, and you want the location of the beginning of the selection, you can do something like this: Dim myRg As Range Set myRg = Selection.Range MyRg.Collapse Direction:=wdCollapseStart MyRow = MyRg.Information(wdEndOfRangeRowNumber) -- Regards, Jay Freedman Microsoft Word MVP FAQ: http://word.mvps.org Email cannot be acknowledged; please post all follow-ups to the newsgroup so all may benefit. |
#3
Posted to microsoft.public.word.tables
|
|||
|
|||
Get current column/row index
This was perfect.
Thanks much. "Jay Freedman" wrote: dmpollock wrote: I am writing a macro to enter text into a table. How can I get the current column and row number where the cursor is in the table? thanks Use the .Information property of the Selection object with the appropriate constants: Selection.Information(wdEndOfRangeColumnNumber) Selection.Information(wdEndOfRangeRowNumber) If the selection is extended and contains more than one cell, the numbers returned refer to the location of the end of the selection. If you think that might be the situation, and you want the location of the beginning of the selection, you can do something like this: Dim myRg As Range Set myRg = Selection.Range MyRg.Collapse Direction:=wdCollapseStart MyRow = MyRg.Information(wdEndOfRangeRowNumber) -- Regards, Jay Freedman Microsoft Word MVP FAQ: http://word.mvps.org Email cannot be acknowledged; please post all follow-ups to the newsgroup so all may benefit. |
Reply |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Word index at current cursor location | Microsoft Word Help | |||
How to get the current Table Index value in my VBA Macro? | Tables | |||
how to jump from index to contents in document and back to index? | New Users | |||
Identical 2-level index tags yield different results in index. Hel | Microsoft Word Help | |||
Concordance/Index File--Make Index Entries Case Insensitive | Microsoft Word Help |