Hi
I have code that cycles though a document's tables. The purpose is to
validate table fields.
As each table cell is accessed I want to populate a text box and display the
data for that cell.
I only get the display for the last table and its last cell. I can display
using the Statusbar but I
would prefer using the form fields.
How do I display the data in a form's text box while a document table is
being accessed?
I am using WORD 2000 and the code is as follows:
----------------------------------------------------------------------------
---------------------------------------------
Private Sub ValidateTables()
Application.ScreenUpdating = False
For Each oTable In ActiveDocument.Tables
With oTable.Rows(1).Cells(1).Range
.MoveEnd Unit:=wdCharacter, Count:=-1
TableName = .Text
End With
fraValidation.Caption = TableName
NumRows = oTable.Rows.Count
Set oRow = oTable.Rows(3).Range
For RowCount = 1 To NumRows - 3
For Each oCell In oRow.Rows(1).Cells
Select Case oCell.ColumnIndex
Case 1
If CellHilight(oCell) Then Exit For
CatNo = GetText(oCell)
txtCatNumber.Text = CatNo
Case 2, 3
ValueText = GetText(oCell)
txtCurrentValue.Text = ValueText
Call ValidateValue(ValueText, ErrorText)
If ErrorDetected then Call CorrectError (ErrorText)
End Select
Next oCell
'
' Prefer to use Forms's Textboxes
'
StatusBar = TableName & Space(4) & ValueText & Space(4) & "Cat
No: " & CatNo
Set oRow = oRow.Next(wdRow)
Next Counter
Next oTable
Application.ScreenUpdating = True
End Sub
----------------------------------------------------------------------------
---------------------------------------------
Thanks in advance for any help and advice or tips.
Jerry Bodoff
JBNewsGroup - 01 Dec 2004 07:09 GMT
Hi,
Ignore this question. I solved the problem by inserting a DoEvents in the
process loop.
Jerry Bodoff
> Hi
>
[quoted text clipped - 90 lines]
>
> Jerry Bodoff