I am very new to macros and I am learning and rookie at vba. I am trying to write a macro which will detect if the document has uniform font size and using same font except for Title page and headings. If any sentence has a different size or different font name then a comment should be added automatically saying check font size or name. For example.
This is an
example to test the font sizes macro
If something like this appears then a comment should be automatically added saying check the font name or size. I dont know how to embed about font name so far it only checks font size.
Code:
Sub CheckFonts()
Dim objSingleWord As Range
Dim objDoc As Document
Dim mycomment As Object
Set objDoc = ActiveDocument
With objDoc
For Each objSingleWord In .Words
If objSingleWord.Font.Size > 10 Then
objSingleWord.Font.Size = 10
mycomment.AddComment "here a comment"
.Comment.Visible = False
End If
Next
End With
End Sub
This is what I have so far but instead of writing a comment it is changing the font size and doesn't detect the font name.
Any help is much appreciated.
Thank you in advance