#1
|
|||
|
|||
Macro to list font and its size on each page
I want a code to see which font and size is used in each page so I can detect mistakes easily and fix them.
Since I'm newto the whole VBA and codes I searched the web and found the following pages.unfortunalty none of them work! https://www.msofficeforums.com/word-...mes-sizes.html I tried the last code and it said that the methode/feature is not available. https://www.msofficeforums.com/word-...-document.html here, it said something about not compiling and Code:
Dim newDoc As Document Dim p As Long Then I tried VBA macro to print all font styles used in a word document - Stack Overflow which nothing seems to happen! I appreciate if you could help me see what I'm missing here! |
#2
|
||||
|
||||
There is no simple way of listing the font and its size on a page.
For starters, Word doesn't work with pages; it 'sees' a document as a continual flow of content, for which pages are merely the way that content is represented for printing. Moreover, simply changing printers can affect what fits on a given page. Then there's the issue of what might appear on a page containing content in multiple fonts and font sizes. And, finally, as soon as you insert something on the page to provide this information about fonts and font sizes, the page content changes - so what gets reported includes an assessment of content that will now be on the next page. All the macros in your links work as intended; they just don't do what you're asking.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#3
|
|||
|
|||
I see!
Then is it possible to check whether the same font (in my case Verdana) is used in the whole document and detect where the font has changed? |
#4
|
||||
|
||||
The macro in: https://www.msofficeforums.com/128199-post4.html is sufficient to confirm whether the whole document uses the same font and/or point size. For a macro to list all fonts used in a document, see: Eileen's Lounge • View topic - Find list of font types in a document by Word macro. Once you know what fonts are in use, a simple Find for a given font's name will locate it.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#5
|
|||
|
|||
I tried this:
Code:
Sub TestFonts() With ActiveDocument.Range If .Font.Name = "" Then .InsertBefore "Check Font Name" & vbCr End With End Sub |
#6
|
|||
|
|||
It is really impossible to "try" what you posted because what you posted doesn't compile.
Code:
Sub TestFonts() Dim bUniformFont As Boolean bUniformFont = True With ActiveDocument.Range If .Font.Name = "" Then .InsertBefore "Check Font Name" & vbCr bUniformFont = False End If If .Font.Size = 9999999 Then .InsertBefore "Check Font Size" & vbCr bUniformFont = False End If End With If bUniformFont Then MsgBox "The font used in your document is uniform. E.g., same font name, same fault size throughout." lbl_Exit: Exit Sub End Sub |
#7
|
|||
|
|||
Thanks!
|
Tags |
font list, font size, macro |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
List box font size increase | jnsiv50 | Excel | 1 | 01-22-2015 07:35 AM |
Increase Font Size in a List Box | Phil H | Excel | 2 | 12-09-2014 08:40 AM |
Looping Macro to Change Font, Font Size, and Give Heading 1 | WH7262 | Word VBA | 1 | 08-26-2014 03:46 PM |
MAcro to List all the Font & its size in a word document | shaukat74 | Word VBA | 1 | 01-29-2013 09:34 PM |
Format Font Size in Combo Box List | lukewarmbeer | Word VBA | 0 | 08-27-2011 07:28 AM |