Change Word Equation Font Format (Word VBA)

This program is used to change the font format of characters in a word equation. The user could choose to change all numeric values to red. Increase the size of special characters like β, α, .. for better readability. Change certain characters to bold, others to italic …. This program was mainly implemented for demonstrative purposes.


Program Description:

When the program initiates a userform is displayed:

Word, VBA, UserForm Equations
On the left side you can see a list box. This listbox has 2 columns:

  1. Right Column: A list of all the characters found in all the equations in the document.
  2. Left Column: Unicode value associated with each character

The listbox is populated with the characters in the documents equations. Upon starting the program the program loops through all the equations in the document. It then adds the characters it finds to this list box:

Equations in document

On the right you can see several options:

  1. Color
  2. Size
  3. Style

Basically the user selects the characters to format from the list box on the left, then chooses to formatting to apply to the characters from the options on the right. After pressing the Run button the changes are applied.


Color:

If the user chooses the first radio button he will then be able to select a color:

Word VBA, Color Equation
Upon pressing the run button, the color chosen will be applied to the characters selected from the listbox:

Word VBA, UserForm Color, Select Red
Result:

As you can see in the figure below, the characters “n” and “x” were colored “red” in the equations:

Color Equation Red, Word VBA


Font Size:

The user can also change the size of characters. In the figure below the user has selected to change the font size of the α and β characters to 12:

Word VBA, Equations  Font Size
Result:

Word VBA Result


Font Style (Bold, Italic, …):

In the figure below the user has selected to change all numeric values to bold:

Word VBA, Numeric Values to Bold
Result:

Word, VBA, Bold Numbers, Equations

If you need assistance with your code, or you are looking for a VBA programmer to hire feel free to contact me. Also please visit my website  www.software-solutions-online.com

Live Chat