Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 04-23-2020, 07:06 AM
Ryhne Ryhne is offline Macro to list font and its size on each page Windows 10 Macro to list font and its size on each page Office 2013
Novice
Macro to list font and its size on each page
 
Join Date: Apr 2020
Posts: 11
Ryhne is on a distinguished road
Default 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
was in red.


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!
Reply With Quote
  #2  
Old 04-23-2020, 02:29 PM
macropod's Avatar
macropod macropod is offline Macro to list font and its size on each page Windows 7 64bit Macro to list font and its size on each page Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,962
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

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]
Reply With Quote
  #3  
Old 04-24-2020, 01:28 AM
Ryhne Ryhne is offline Macro to list font and its size on each page Windows 10 Macro to list font and its size on each page Office 2013
Novice
Macro to list font and its size on each page
 
Join Date: Apr 2020
Posts: 11
Ryhne is on a distinguished road
Default

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?
Reply With Quote
  #4  
Old 04-24-2020, 02:56 AM
macropod's Avatar
macropod macropod is offline Macro to list font and its size on each page Windows 7 64bit Macro to list font and its size on each page Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,962
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

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]
Reply With Quote
  #5  
Old 04-24-2020, 06:30 AM
Ryhne Ryhne is offline Macro to list font and its size on each page Windows 10 Macro to list font and its size on each page Office 2013
Novice
Macro to list font and its size on each page
 
Join Date: Apr 2020
Posts: 11
Ryhne is on a distinguished road
Default

I tried this:
Code:
Sub TestFonts() With ActiveDocument.Range  
 If .Font.Name = "" Then .InsertBefore "Check Font Name" & vbCr
 End With
 End Sub
and nothing happens.
Reply With Quote
  #6  
Old 04-24-2020, 09:36 AM
gmaxey gmaxey is offline Macro to list font and its size on each page Windows 10 Macro to list font and its size on each page Office 2016
Expert
 
Join Date: May 2010
Location: Brasstown, NC
Posts: 1,427
gmaxey is a jewel in the roughgmaxey is a jewel in the roughgmaxey is a jewel in the roughgmaxey is a jewel in the rough
Default

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
__________________
Greg Maxey
Please visit my web site at http://www.gregmaxey.com/
Reply With Quote
  #7  
Old 04-26-2020, 04:51 AM
Ryhne Ryhne is offline Macro to list font and its size on each page Windows 10 Macro to list font and its size on each page Office 2013
Novice
Macro to list font and its size on each page
 
Join Date: Apr 2020
Posts: 11
Ryhne is on a distinguished road
Default

Thanks!
Reply With Quote
Reply

Tags
font list, font size, macro

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro to list font and its size on each page 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
Macro to list font and its size on each page Looping Macro to Change Font, Font Size, and Give Heading 1 WH7262 Word VBA 1 08-26-2014 03:46 PM
Macro to list font and its size on each page 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

Other Forums: Access Forums

All times are GMT -7. The time now is 03:05 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft