G
Greg Maxey
Insert a 4 or more empty table in a document and run this code:
Sub Demo()
Dim oTbl As Word.Table
Dim i As Long
Set oTbl = ActiveDocument.Tables(1)
Set oTbl = Nothing
With oTbl
For i = .Rows.Count To 1 Step -1
If i = 3 Then Set oTbl = Nothing
.Rows(i).Delete
Next i
End With
End Sub
Why doesn't this code throw a RTE 91 when it reaches the point where it
tries to delete a row after the oTbl object has been set to Nothing?
Sub Demo()
Dim oTbl As Word.Table
Dim i As Long
Set oTbl = ActiveDocument.Tables(1)
Set oTbl = Nothing
With oTbl
For i = .Rows.Count To 1 Step -1
If i = 3 Then Set oTbl = Nothing
.Rows(i).Delete
Next i
End With
End Sub
Why doesn't this code throw a RTE 91 when it reaches the point where it
tries to delete a row after the oTbl object has been set to Nothing?