Word Typesetting Notes

Word Macros

Cross-reference Color

Automatically formats cross-references in Word, as well as Endnote/Zotero cross-references, with the default color set to blue.

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

Mathtype Uniform Scaling

Used to fix inconsistent heights of Mathtype equations after updating, by reapplying uniform scaling.

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 page was automatically translated by generative AI and may contain inaccuracies or incomplete information. Feedback is welcome to help us improve.




    Enjoy Reading This Article?

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

  • macOS System Configuration Notes
  • Practical Configuration Notes for Low-Performance Cloud Servers
  • Essay: Memories of the Old Home
  • Essay: The First Day of 2025, Some Thoughts
  • 2024 Work Summary