Word 排版记录

Word 宏

交叉引用颜色

用于将 word 中的交叉引用、Endnote/Zotero 交叉引用自动格式化,默认颜色为蓝色。

Sub CitingColor()
    For i = 1 To ActiveDocument.Fields.Count '遍历文档所有域
        If Left(ActiveDocument.Fields(i).Code, 4) = " REF" Or Left(ActiveDocument.Fields(i).Code, 14) = " ADDIN EN.CITE" Or Left(ActiveDocument.Fields(i).Code, 31) = " ADDIN ZOTERO_ITEM CSL_CITATION" Then 'Word自带的交叉引用的域代码起始4位是" REF"(注意空格),EndNote插入的引用域代码的起始14位是" ADDIN EN.CITE",Zotero插入的引用域代码的起始31位是" ADDIN ZOTERO_ITEM CSL_CITATION"。根据需求可添加其他类型。
        ActiveDocument.Fields(i).Select '选中上述几类域
        Selection.Font.Color = RGB(31, 77, 160) '设置字体颜色
        End If
    Next
End Sub

Mathtype 统一缩放

用于处理 Mathtype 公式更新后部分公式高度不一致的问题,重新统一缩放代码。

Sub EqMathtype_100()
'
' EqMathtype_100 Macro
''
Dim i As Integer
Dim total As Integer
total = ActiveDocument.InlineShapes.Count
i = 0
For Each s In ActiveDocument.InlineShapes
i = i + 1
On Error Resume Next
Application.StatusBar = "Progress: " & i & " of " & total
If s.Type = msoAutoShape Then
If s.OLEFormat.ClassType = "Equation.DSMT4" Then
With s
.ScaleHeight = 100
.ScaleWidth = 100
End With
End If
End If
Next
End Sub



    Enjoy Reading This Article?

    Here are some more articles you might like to read next:

  • 中文文案排版指南
  • 自定义 zsh 实现命令自动补全
  • Windows实用配置记录
  • 我的表达欲在递减
  • 一份简明的 Markdown 笔记与教程