I have a macro (code below) that generates a sample of the fonts on a
specific computer. On one system, it found fonts (duplicates) with a name
that started with @ such as @Arial. This apparently sent a code to the
printer so it stopped printing from that point in the document. Once I
manually deleted those initial entries, the print job was fine.
Is there an easy way to either skip all entries with a prefix of @ or to
create a starting point in the list of fonts such as Aa?
Thank you in advance.
**START OF CODE
Dim iCharNumber As Integer, iPointSize As Integer, iNumberOfFonts As Integer
Dim vFontName As Variant, i As Integer
Dim sSortedFontNames() As String
ReDim sSortedFontNames(FontNames.Count)
On Error GoTo UserClickedCancel
' Prompt for point size of samples
iPointSize = InputBox("Print fonts at which point size (such as 12 or 14)?",
"Print Font List")
MsgBox "The creation of the print fonts list may take a few minutes-a prompt
will appear when the list is completed", vbInformation, "Please Wait"
On Error GoTo 0
i = 0
For Each vFontName In FontNames
i = i + 1
sSortedFontNames(i) = vFontName
Next vFontName
WordBasic.SortArray sSortedFontNames()
Selection.GoTo What:=wdGoToBookmark, Name:="start"
' Build list
For i = 1 To FontNames.Count
Selection.ParagraphFormat.KeepWithNext = True
Selection.Font.Size = 11
Selection.Font.Name = "Times New Roman"
Selection.TypeText sSortedFontNames(i) & " at " & iPointSize & " points:"
Selection.TypeParagraph
Selection.Font.Size = iPointSize
Selection.Font.Name = sSortedFontNames(i)
Selection.TypeText Text:="The quick brown fox jumps over the lazy dog"
Selection.TypeParagraph
For iCharNumber = 33 To 122
Selection.TypeText Chr(iCharNumber) & " "
Next iCharNumber
Selection.ParagraphFormat.KeepWithNext = False
Selection.TypeParagraph
Selection.TypeParagraph
Next i
UserClickedCancel:
**END OF CODE
Thank you for your help,
Dawn

Signature
Dawn Bjork Buzbee
Greg Maxey - 23 Apr 2007 20:36 GMT
Dawn
You could add a condtion:
If Not Mid(vFontName, 1) = "@" Then
sSortedFontNames(i) = vFontName
End If
On Apr 23, 2:36 pm, Dawn Bjork Buzbee
<DawnBjorkBuz...@discussions.microsoft.com> wrote:
> I have a macro (code below) that generates a sample of the fonts on a
> specific computer. On one system, it found fonts (duplicates) with a name
[quoted text clipped - 57 lines]
> --
> Dawn Bjork Buzbee
Jay Freedman - 23 Apr 2007 20:42 GMT
Insert this line immediately after the line For i = 1 To FontNames.Count :
If Left(sSortedFontNames(i), 1) <> "@" Then
and insert this line immediately before the line Next i :
End If

Signature
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.
> I have a macro (code below) that generates a sample of the fonts on a
> specific computer. On one system, it found fonts (duplicates) with a
[quoted text clipped - 57 lines]
> Thank you for your help,
> Dawn
Dawn Bjork Buzbee - 23 Apr 2007 21:20 GMT
Thank you, Jay, for your expertise and great answer. DBB

Signature
Dawn Bjork Buzbee
> Insert this line immediately after the line For i = 1 To FontNames.Count :
>
[quoted text clipped - 3 lines]
>
> End If
Greg Maxey - 23 Apr 2007 20:49 GMT
Dawn you could use a condition:
If Not Mid(vFontName, 1) = "@" Then
sSortedFontNames(i) = vFontName
End If
On Apr 23, 2:36 pm, Dawn Bjork Buzbee
<DawnBjorkBuz...@discussions.microsoft.com> wrote:
> I have a macro (code below) that generates a sample of the fonts on a
> specific computer. On one system, it found fonts (duplicates) with a name
[quoted text clipped - 57 lines]
> --
> Dawn Bjork Buzbee
Dawn Bjork Buzbee - 23 Apr 2007 21:22 GMT
Thank you, Greg, for your expertise and great answer. DBB

Signature
Dawn Bjork Buzbee
> Dawn you could use a condition:
>
> If Not Mid(vFontName, 1) = "@" Then
> sSortedFontNames(i) = vFontName
> End If