|
Option Explicit
Sub test1()
Dim ar, i&, n&, strInsert$, objTable As Table, strRngText$
strInsert = InputBox("请输入需要加入字符", "", "0")
If strInsert = "" Then Exit Sub
Application.ScreenUpdating = False
With ActiveDocument
For Each objTable In .Tables
With objTable
n = .Range.Cells.Count
For i = 1 To n
strRngText = Left(.Range.Cells(i).Range.Text, Len(.Range.Cells(i).Range.Text) - 2)
If Len(strRngText) Then .Range.Cells(i).Range.Text = strRngText & strInsert
Next i
End With
Next
End With
Application.ScreenUpdating = True
Beep
End Sub |
|