Ed was telling us:
Ed nous racontait que :
Is there a way using VBA to identify the column and row of the Word
table cell containing the insertion point, or that has been selected?
(An equivalent to Excel's ActiveCell)
Try the following. Note that if you are dealing with tables containing
merged cells, then it will not work.
'_______________________________________
Dim IndexCol As Long
Dim IndexRow As Long
With Selection
If Not .Information(wdWithInTable) Then
MsgBox "Selection must be in a table cell.", _
vbCritical, "Invalid Selection"
Exit Sub
Else
IndexCol = .Columns(1).Index
IndexRow = .Rows(1).Index
MsgBox "The coordinates of the top left cell of " _
& "the current selection is row " & IndexRow _
& " and column " & IndexCol & ".", _
vbInformation, "Active Cell"
End If
End With
'_______________________________________
--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
(e-mail address removed)
Word MVP site:
http://www.word.mvps.org