Article ID: 187818
Article Last Modified on 8/21/2007
Sub AnsiChars()
Dim dlgFont As Dialog
Dim iCount As Integer
Dim defFont As String
' Create a new document.
Documents.Add
' Get name of default font
defFont = Selection.Font.Name
' Display Font dialog box to choose the font
' from which the ANSI character will be retrieved.
Set dlgFont = Dialogs(wdDialogFormatFont)
dlgFont.Display
With Selection
' Insert the name of the chosen font.
.TypeText dlgFont.Font & vbCr
' Set the point size of the chosen font.
.Font.Size = dlgFont.Points
' Retrieve ANSI character set.
For iCount = 128 To 255
' Set font to default font.
.Font.Name = defFont
' Insert ANSI character number.
.TypeText CStr(iCount) & " - "
' Set font to chosen font.
.Font.Name = dlgFont.Font
' Insert ANSI character.
.TypeText Chr(iCount) & vbCr
' Loop until done.
Next iCount
End With
End Sub
163435 VBA: Programming Resources for Visual Basic for Applications
173707 OFF97: How to Run Sample Code from Knowledge Base Articles
Additional query words: wordcon vba vb vbe print printer
Keywords: kbhowto kbprogramming KB187818