Hi- am wanting to loop through tables in a Word document, and if the formfield in cell (1, 2) is blank, then the table is deleted. The problem seems to be with identifying the formfield as being blank. I run the code and nothing happens, although if I specify a value that exists in one of the formfields, the code works and the table is deleted.
I have tried Trim, Len, Null, IsEmpty, but none work.
Sub BlankFldsInTbl()
Set WdApp = Word.Application
Dim Tbl As Table
With WdApp.ActiveDocument
For Each Tbl In .Tables
If Tbl.Cell(1, 2).Range.Fields(1).Result = "" Then
Tbl.Delete
WdApp.Selection.MoveRight Unit:=wdCharacter, Count:=1
WdApp.Selection.TypeBackspace
WdApp.Selection.TypeBackspace
End If
Next Tbl
End With
End Sub