Skip to content
Back to home

Word Formatting Record

Table of Contents

Open Table of Contents

Word Macros

Cross-Reference Color

Used to automatically format cross-references in Word, Endnote/Zotero cross-references, default color blue.

Sub CitingColor()
    For i = 1 To ActiveDocument.Fields.Count 'Traverse all fields in the document
        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's built-in cross-reference field code starts with " REF" (note space), EndNote inserted citation field code starts with " ADDIN EN.CITE", Zotero inserted citation field code starts with " ADDIN ZOTERO_ITEM CSL_CITATION". Can add other types as needed.
        ActiveDocument.Fields(i).Select 'Select the above types of fields
        Selection.Font.Color = RGB(31, 77, 160) 'Set font color
        End If
    Next
End Sub

Mathtype Unified Scaling

Used to handle inconsistent formula heights after Mathtype formula updates, re-unify scaling code.

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

This work is licensed under “CC BY-NC-SA 4.0”. For commercial use, please contact the site owner for authorization. For non-commercial sharing, please keep attribution and the original link. If you remix, transform, or build upon this material, you must distribute your contributions under the same license.

Share this post on:

Previous Post
Repost | Why Still Blog
Next Post
Essay | Understanding the Slippery Slope Fallacy