reading the content of table cell in word 2007

G

gopher87

Hi all

If the cursor (focus) is on the 5th column of a word table, how can I
read into a variable the content of the cell in the 1st column of the
same row?

Can I do that?

Thanks!
 
D

Doug Robbins - Word MVP

Dim myrange As Range
Set myrange = Selection.Rows(1).Range
Set myrange = myrange.Cells(1).Range
myrange.End = myrange.End - 1
MsgBox myrange.Text


--
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, originally posted via msnews.microsoft.com
 
G

gopher87

Doug said:
Dim myrange As Range
Set myrange = Selection.Rows(1).Range
Set myrange = myrange.Cells(1).Range
myrange.End = myrange.End - 1
MsgBox myrange.Text
That worked! Thank you!
 

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