Thanks.
I figured out how to do this but I highly doubt this is the most
efficient way. Basically what I did was select the text in the table
cell that I wanted. What this does is it makes it avalible via the
selection object. Once in the selection object I can use the Text
method to access the string.
For example
# Select the first cell in the first row
MyTable.Cell(1, 1).Select
# Assign the section text to the string cellvalue
cellvalue = Selection.Text
Terrence
Hi Terrence,
modified example:
Dim s As String
s = ActiveDocument.Tables(1).Cell(1, 2).Range.Text
s = Left(s, Len(s) - 2)
And note the difference to Doug's example.
On the surface, more or less, where Doug's code operates,
the end-of-cell mark is one (!) character,
whereas if you put all of the cell's range text into a variable,
you have to cut off two (!) characters.
BTW there is a minor typo in Doug's code, as it happens.
Set myrange = ActiveDocument.Tables(n).Cells(i , j).Range ' no
Set myrange = ActiveDocument.Tables(n).Cell(i , j).Range ' yes
So you got two solutions. ;-)
Greetings from Bavaria, Germany
Helmut Weber, MVP WordVBA
Win XP, Office 2003
"red.sys" & Chr$(64) & "t-online.de"