Sub del()
On Error Resume Next
Application.DisplayAlerts = False
For j = ActiveDocument.Tables.Count To 1 Step -1
If Len(ActiveDocument.Tables(j).Cell(2, 1).Range.Text) = 2 Then
Documents(1).Tables(j).Range.Select
ActiveDocument.Tables(j).Delete
Selection.Font.Color = wdColorAutomatic
Selection.Font.Size = 11
Selection.TypeText Text:=vbTab
Selection.TypeText “暂时没有详细数据。”
Selection.TypeParagraph
End If
Next
Application.DisplayAlerts = True
End Sub
如果想删除表格,直接把Selection.TypeText "暂时没有详细数据。"改成Selection.Delete
如何运用vba删除Word中的表格
最新推荐文章于 2021-10-22 13:18:15 发布