determine table cell value

J

JerryMB

I have done vba in access and excel but in word I can't seem to get this
right probably because it is right in front of my face.

How do I use the value from a word table cell in a macro?

The value of cell (1,1) will determine an action on cell(1,2) of table(1)
and the value of Cell (1,1) needs to be displayed in a msgbox.
 
J

JerryMB

Thanks but if what I was looking for was there I didn't see it. But looking
through it I found an answer to a borders question for a different project
--Thanks
 
J

JerryMB

Found it in a earlier discussion - must be my bad search technique

myString = ActiveDocument.Table(1).Cell(2,2).Range.Text
 
D

Doug Robbins - Word MVP

That will include the end of cell marker in myString. To exclude it, use

Dim myrange as Range
Set myrange = ActiveDocument.Tables(1).Cell(2, 2).Range
myrange.End = myrange.End - 1
MsgBox myrange

--
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
 
J

JerryMB

Thanks Doug that is cleaner than the method I used -- Basicly
strMystr2= Mid(strMystr,1,(Len(strMystr)-2)
 

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