Last active
September 9, 2025 07:41
-
-
Save cocomice/60edc2ac43eb510f6ad3ab5a39890aad to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ' 该宏脚本运行用户在修订模式下,“接收修订”后保留修订前后的格式(删除、不同颜色等) | |
| Sub acceptChanges() | |
| Dim oRev As Revision | |
| For Each oRev In ActiveDocument.Revisions | |
| If oRev.Type = wdRevisionInsert Then | |
| oRev.Range.Font.Color = wdColorBlue | |
| oRev.Accept | |
| ElseIf oRev.Type = wdRevisionDelete Then | |
| oRev.Range.Font.Color = wdColorRed | |
| oRev.Range.Font.StrikeThrough = True | |
| oRev.Reject | |
| End If | |
| Next | |
| End Sub |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Sub DeleteUnusedStyles() | |
| Dim doc As Document | |
| Dim s As Style | |
| Dim styleInUse As Boolean | |
| Dim rng As Range | |
| Set doc = ActiveDocument | |
| For Each s In doc.Styles | |
| If Not s.BuiltIn Then | |
| styleInUse = False | |
| For Each rng In doc.StoryRanges | |
| If rng.Find.Style = s Then | |
| styleIn-use = True | |
| Exit For | |
| End If | |
| Next rng | |
| If Not styleInUse Then | |
| s.Delete | |
| End If | |
| End If | |
| Next s | |
| End Sub |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment