|
139:不好意思,我只是你的初级(小学)VBA老师,和论坛高人无法比!——请试试下面的宏(黑圈123和白圈一二三后加顿号):
- Sub test()
- 'MS Gothic字体:黑圈1/2/3后加顿号
- Selection.HomeKey unit:=wdStory
- Do
- Selection.Find.ClearFormatting
- Selection.Find.Execute findtext:=ChrW(10102)
- If Selection.Find.Found = True Then
- Selection.MoveEnd unit:=wdCharacter, Count:=1
- If Selection.Characters.Last.Text Like "[ ]" Or Selection.Characters.Last.Text = ChrW(160) Then Selection.Characters.Last.Delete
- If Selection.Characters.Last.Text <> "、" Then Selection.InsertAfter Text:="、"
- Selection.MoveRight unit:=wdCharacter, Count:=1
- End If
- Loop Until Selection.Find.Found = False
- '
- Selection.HomeKey unit:=wdStory
- Do
- Selection.Find.ClearFormatting
- Selection.Find.Execute findtext:=ChrW(10103)
- If Selection.Find.Found = True Then
- Selection.MoveEnd unit:=wdCharacter, Count:=1
- If Selection.Characters.Last.Text Like "[ ]" Or Selection.Characters.Last.Text = ChrW(160) Then Selection.Characters.Last.Delete
- If Selection.Characters.Last.Text <> "、" Then Selection.InsertAfter Text:="、"
- Selection.MoveRight unit:=wdCharacter, Count:=1
- End If
- Loop Until Selection.Find.Found = False
- '
- Selection.HomeKey unit:=wdStory
- Do
- Selection.Find.ClearFormatting
- Selection.Find.Execute findtext:=ChrW(10104)
- If Selection.Find.Found = True Then
- Selection.MoveEnd unit:=wdCharacter, Count:=1
- If Selection.Characters.Last.Text Like "[ ]" Or Selection.Characters.Last.Text = ChrW(160) Then Selection.Characters.Last.Delete
- If Selection.Characters.Last.Text <> "、" Then Selection.InsertAfter Text:="、"
- Selection.MoveRight unit:=wdCharacter, Count:=1
- End If
- Loop Until Selection.Find.Found = False
- 'MS Gothic字体:白圈一/二/三后加顿号
- Selection.HomeKey unit:=wdStory
- Do
- Selection.Find.ClearFormatting
- Selection.Find.Execute findtext:=ChrW(12928)
- If Selection.Find.Found = True Then
- Selection.MoveEnd unit:=wdCharacter, Count:=1
- If Selection.Characters.Last.Text Like "[ ]" Or Selection.Characters.Last.Text = ChrW(160) Then Selection.Characters.Last.Delete
- If Selection.Characters.Last.Text <> "、" Then Selection.InsertAfter Text:="、"
- Selection.MoveRight unit:=wdCharacter, Count:=1
- End If
- Loop Until Selection.Find.Found = False
- Selection.HomeKey unit:=wdStory
- Do
- Selection.Find.ClearFormatting
- Selection.Find.Execute findtext:=ChrW(12929)
- If Selection.Find.Found = True Then
- Selection.MoveEnd unit:=wdCharacter, Count:=1
- If Selection.Characters.Last.Text Like "[ ]" Or Selection.Characters.Last.Text = ChrW(160) Then Selection.Characters.Last.Delete
- If Selection.Characters.Last.Text <> "、" Then Selection.InsertAfter Text:="、"
- Selection.MoveRight unit:=wdCharacter, Count:=1
- End If
- Loop Until Selection.Find.Found = False
- Selection.HomeKey unit:=wdStory
- Do
- Selection.Find.ClearFormatting
- Selection.Find.Execute findtext:=ChrW(12930)
- If Selection.Find.Found = True Then
- Selection.MoveEnd unit:=wdCharacter, Count:=1
- If Selection.Characters.Last.Text Like "[ ]" Or Selection.Characters.Last.Text = ChrW(160) Then Selection.Characters.Last.Delete
- If Selection.Characters.Last.Text <> "、" Then Selection.InsertAfter Text:="、"
- Selection.MoveRight unit:=wdCharacter, Count:=1
- End If
- Loop Until Selection.Find.Found = False
- End Sub
复制代码 |
|