change text font in a text box

We had a colleague in the Chemistry Department, Laura End, who went off to teach in Malaysia. She generously left behind a large number of Chemistry resources but they were all in Clown font – Comic Sans. If you change the font of a document to Grown-Up font, Arial, it won’t change the contents of text boxes so you have to go through changing the contents of text boxes individually.

The following macro will change the contents of all the textboxes in a document to Grown-Up font:

Sub ChangeTextInTextbox()
    Dim objShape As Shape
  Dim objDoc As Document
   Set objDoc = ActiveDocument
   With objDoc
    For Each objShape In .Shapes
     If objShape.Type = msoTextBox Then
        objShape.TextFrame.TextRange.Font.Name = “Arial”
        objShape.TextFrame.TextRange.Font.Size = “11”
        objShape.TextFrame.TextRange.Font.Color = wdColorBlack
        objShape.TextFrame.TextRange.ParagraphFormat.Alignment = wdAlignParagraphJustify
      End If
    Next
  End With
  End Sub

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: