Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / March 2005

Tip: Looking for answers? Try searching our database.

Adding font name

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Lee - 10 Mar 2005 20:15 GMT
Hi All
I have the following code which types "ABCD..." in each font type that you
have on your PC.  I want to also add each font name to the generated document
next to each the corresponding line of text in that font, e.g.
ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz 123456789 - Arial

Sub listfonts()

Documents.Add

For Each thisfont In FontNames

   With Selection
       .InsertAfter "ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz
123456789" & vbCr
       .MoveUp unit:=wdParagraph, Count:=1
       .MoveDown unit:=wdParagraph, Count:=1, Extend:=wdExtend
       .Font.Name = thisfont
       .Font.Size = 10
       .MoveDown unit:=wdParagraph, Count:=2
   End With
   Next
End Sub

Any help would be appreciated. Thanks
Helmut Weber - 11 Mar 2005 10:58 GMT
Hi Lee,

how about this one:

Dim sFnt As Variant
Dim sExm As String
Dim lPrg As Long
'sExm = "ABCDEFGHIJKLMNOPQRSTUVWXYZ "
sExm = "abcdefghijklmnopqrstuvwxyz - "
'sExm = sExm & "123456789 - "
With ActiveDocument
  .Range.Delete
  For Each sFnt In FontNames
     .Range.InsertAfter sExm & sFnt & vbCr
     lPrg = .Paragraphs.count
     .Range.Paragraphs(lPrg - 1).Range.Font.Name = sFnt
  Next
End With

Greetings from Bavaria, Germany
Helmut Weber, MVP
"red.sys" & chr(64) & "t-online.de"
Word 2002, Windows 2000
Lee - 22 Mar 2005 22:44 GMT
Thanks Helmut
Worked perfectly!

> Hi Lee,
>
[quoted text clipped - 19 lines]
> "red.sys" & chr(64) & "t-online.de"
> Word 2002, Windows 2000
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.