Sub DirectFormat()
Dim para As Paragraph
Dim fnt As Font
Dim pfmt As ParagraphFormat
For Each para In ActiveDocument.Paragraphs
With para
If .Style <> ActiveDocument.Styles("Normal") Then
Set fnt = .Style.Font
Set pfmt = .Style.ParagraphFormat
.Style = ActiveDocument.Styles("Normal")
.Range.Font = fnt
.Range.ParagraphFormat = pfmt
End If
End With
Next
End Sub
Sub DirectFormat()
Dim para As Paragraph
Dim fnt As Font
Dim pfmt As ParagraphFormat
For Each para In ActiveDocument.Paragraphs
With para
If .Style <> ActiveDocument.Styles("Normal") Then
Set fnt = .Style.Font
Set pfmt = .Style.ParagraphFormat
.Style = ActiveDocument.Styles("Normal")
.Range.Font = fnt
.Range.ParagraphFormat = pfmt
End If
End With
Next
End Sub
需要注意的是,如果你同時打開了多份 Word 文檔,那么在上述 VBA 編輯器的左側,也會出現(xiàn)多個文檔的選項。這種場合,請保證選中了 Project(需要去除樣式的文檔)-Microsoft Word Objects-ThisDocument 并使其高亮,然后再在右側粘貼并執(zhí)行代碼。