Displays the Font dialog box.
object.ShowFont ( pFont ) |
- pFont
- Required. A variable declared as a Font object.
Boolean
The ShowFont method returns True if the OK button was pressed in the Font dialog and False if the Cancel button was pressed.
Allows the user to select a font and displays the font details.
ShowFont Example (VBScript) | Copy Code |
---|---|
Sub ShowFont Dim pFont, blnOK Set pFont = Application.CreateAppObject ("font") blnOK = CommonDialog.ShowFont (pFont) If blnOK Then MsgBox "Here are the details of the font you selected:" & vbCrlf & _ "Bold: " & pFont.Bold & vbCrlf & _ "Charset: " & pFont.Charset & vbCrlf & _ "Italic: " & pFont.Italic & vbCrlf & _ "Name: " & pFont.Name & vbCrlf & _ "Size: " & pFont.Size & vbCrlf & _ "Strikethrough: " & pFont.StrikeThrough & vbCrlf & _ "Underlined: " & pFont.Underline & vbCrlf & _ "Weight: " & pFont.Weight, vbInformation, "Font details" Else MsgBox "No font selected. The Cancel button was pushed.", vbInformation, "No font selected" End If End Sub |