|
楼主,有现成的宏,试试下面的宏:(你可以在本论坛搜索我的--Word2003 通用模板 2016元旦版,里面有很多免费实用的宏)
- Sub 姓名加空()
- Dim c As Cell, r As Range, myRange As Range
- If Selection.Type = wdSelectionIP Then Selection.SelectColumn
- Set myRange = Selection.Range
- myRange.Find.Execute FindText:="^w", replacewith:="", Replace:=wdReplaceAll
- myRange.Find.Execute FindText:=" ", replacewith:="", Replace:=wdReplaceAll
- myRange.Select
- For Each c In Selection.Cells
- Set r = c.Range
- r.MoveEnd unit:=wdCharacter, Count:=-1
- If Len(r.Text) = 0 Then
- r.Shading.BackgroundPatternColor = wdColorRed
- ElseIf Len(r.Text) = 1 Then
- r.Shading.BackgroundPatternColor = wdColorBrightGreen
- ElseIf Len(r.Text) = 2 Then
- r.Characters(1).InsertAfter Text:=Space(2)
- ElseIf Len(r.Text) >= 4 Then
- r.Shading.BackgroundPatternColor = wdColorBrightGreen
- End If
- Next
- End Sub
复制代码 |
评分
-
1
查看全部评分
-
|