D
Debra Farnham
Hello All
Windows 2K
Word 2K
I'm trying to locate a string (strFWitnessName) in a table in my document
and then move one cell to the right to enter a page number.
strFWitnessName could appear in 1 of three tables in the document ( but it
will never appear in all three)
I do not want to search the entire document as strFWitnessName will appear
throughout the document text as well.
I found the following code posted by Doug Robbins and tried testing it but
apparently I am just not familiar enough with vba to understand what it is
doing.
Dim i As Integer, j As Integer, myrange As Range
For j = 1 To ActiveDocument.Tables.Count
For i = 1 To ActiveDocument.Tables(j).Rows.Count
Set myrange = ActiveDocument.Tables(j).Cell(i, 1).Range
myrange.End = myrange.End - 1
If myrange.Text = strFWitnessName Then
ActiveDocument.Tables(j).Cell(i, 2).Range.Text = "pagenumber1"
ActiveDocument.Tables(j).Cell(i, 3).Range.Text = "pagenumber2"
End If
Next i
Next j
Any help would be greatly appreciated.
TIA
Debra
Windows 2K
Word 2K
I'm trying to locate a string (strFWitnessName) in a table in my document
and then move one cell to the right to enter a page number.
strFWitnessName could appear in 1 of three tables in the document ( but it
will never appear in all three)
I do not want to search the entire document as strFWitnessName will appear
throughout the document text as well.
I found the following code posted by Doug Robbins and tried testing it but
apparently I am just not familiar enough with vba to understand what it is
doing.
Dim i As Integer, j As Integer, myrange As Range
For j = 1 To ActiveDocument.Tables.Count
For i = 1 To ActiveDocument.Tables(j).Rows.Count
Set myrange = ActiveDocument.Tables(j).Cell(i, 1).Range
myrange.End = myrange.End - 1
If myrange.Text = strFWitnessName Then
ActiveDocument.Tables(j).Cell(i, 2).Range.Text = "pagenumber1"
ActiveDocument.Tables(j).Cell(i, 3).Range.Text = "pagenumber2"
End If
Next i
Next j
Any help would be greatly appreciated.
TIA
Debra