MS Word VBA Coding Help

Journey037 1 Reputation point
2020-12-25T04:53:57.897+00:00

I saw this article and it was a huge help.
https://www.datanumen.com/blogs/3-ways-batch-change-text-format-text-boxes-word-document/
But I'm a novice and can't figure out how to code a module to change the font color of all text inside all shapes in my enormous Word document.
I'd be grateful for any help.

Developer technologies Visual Basic for Applications
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Richard Michaels 126 Reputation points
    2020-12-29T14:41:56.143+00:00

    The article you reference provide VBA code you can learn from. In the routine they are changing font size with the following:

    objShape.TextFrame.TextRange.Font.Size = “16"

    To change the color of text, that is also a property of Font. Below is an example you could use to change the color to Blue.

     objShape.TextFrame.TextRange.Font.ColorIndex = wdBlue
    

    You can do a web search on Word VBA Font.ColorIndex Enumeration and get a listing of all the color values.

    0 comments No comments

  2. Bill Bell 6 Reputation points
    2021-01-14T20:05:18.9+00:00

    You can get Word 2013 and other VBA documentation at:

    https://www.microsoft.com/en-us/download/details.aspx?id=40326

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.