0
我們如何在Microsoft Word 2010中使所有合併字段變爲粗體?請建議使用VBA的方法。此外,如果條件也必須變爲粗體,合併出現在內的字段。合併字段Bold Word 2010
我們如何在Microsoft Word 2010中使所有合併字段變爲粗體?請建議使用VBA的方法。此外,如果條件也必須變爲粗體,合併出現在內的字段。合併字段Bold Word 2010
您可以使用查找和替換來記錄宏。使用^d
查找所有字段,並使用^&
替換爲相同的文本,並將格式設置爲粗體。在錄製之前,通過選擇全部並使用Shift + F9來切換所有字段代碼。記錄此過程將生成以下VBA代碼:
Sub MergeBold()
'
' MergeBold Macro
'
'
Selection.WholeStory
Selection.Fields.ToggleShowCodes
Selection.MoveRight Unit:=wdCharacter, Count:=1
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
Selection.Find.Replacement.Font.Bold = True
With Selection.Find
.Text = "^d"
.Replacement.Text = "^&"
.Forward = True
.Wrap = wdFindContinue
.Format = True
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
Selection.WholeStory
Selection.Fields.ToggleShowCodes
Selection.MoveRight Unit:=wdCharacter, Count:=1
End Sub