以下是引用xxcc在2006-12-14 8:42:34的发言:谢谢,已经搞定!再深问一步,如何在此段代码中增加判断语句,施工负责人"后面的表格是否含有斜线,如有则不增加“马良”,继续向下搜索 请参考: Option Explicit Sub Example() Dim myRange As Range, myString As String, myCell As Cell Dim i As Table Application.ScreenUpdating = False myString = "施工负责人" For Each i In ActiveDocument.Tables Set myRange = i.Range With myRange.Find .ClearFormatting .Text = myString Do While .Execute = True Set myCell = myRange.Cells(1).Next If myCell.Borders(wdBorderDiagonalDown) = False And myCell.Borders(wdBorderDiagonalUp) = False Then myCell.Range.Text = "马良" End If GoTo NF Loop End With NF: Next Application.ScreenUpdating = True End Sub |