SetFont Method |
Sets the definition data of the font for the TextStyle.
Signature
RetVal = object.SetFont(Typeface, Bold, Italic, CharSet, PitchAndFamily)
Object
TextStyle
The object or objects this method applies to.
Typeface
String; input-only
The typeface (font name).
Bold
Boolean; input-only
Sets the TextStyle to bold.
TRUE: The TextStyle is bold.
FALSE: The TextStyle is not bold.
Italic
Boolean; input-only
Sets the TextStyle to italic.
TRUE: The TextStyle is italic.
FALSE: The TextStyle is not italic.
CharSet
Long; input-only
The character set for the font. (See the available values in the
Remarks section.)
PitchAndFamily
Long; input-only
The pitch and family definitions for the font. (See the available
values in the Remarks section.)
Remarks
The following section provides definitions for constants to use with this method. To use these constants, copy the definitions you need and paste them into the Declarations section of your application. A complete list of the constants that are available from Microsoft can be found in the file win32api.txt, which is provided with the Visual Basic Development Environment.
The CharSet parameter specifies the character set for the font. To use the following constants in your VB or VBA application, copy the definitions into the Declaration section of your code.
Public Const ANSI_CHARSET = 0 Public Const DEFAULT_CHARSET = 1 Public Const SYMBOL_CHARSET = 2 Public Const SHIFTJIS_CHARSET = 128 Public Const OEM_CHARSET = 255
The PitchAndFamily parameter specifies the pitch and family values for the font. The value is determined by a combination of three different settings. To provide the PitchAndFamily value, choose a setting from each of the categories, and then use the OR operator to combine them. A setting is required from the first two categories; the pitch and the family. The third category, the TrueType Flag, is only used when you are specifying a TrueType font.
To use the following constants in your VB or VBA application, copy the definitions into the Declaration section of your code.
' Pitch Values Public Const DEFAULT_PITCH = 0 Public Const FIXED_PITCH = 1 Public Const VARIABLE_PITCH = 2 ' Family Values Public Const FF_DONTCARE = 0 ' Don't care or don't know. Public Const FF_ROMAN = 16 ' Variable stroke width, serifed. Public Const FF_SWISS = 32 ' Variable stroke width, sans-serifed. Public Const FF_MODERN = 48 ' Constant stroke width, serifed or sans-serifed. Public Const FF_SCRIPT = 64 ' Cursive, etc. Public Const FF_DECORATIVE = 80 ' Old English, etc. ' TrueType Flag Public Const TMPF_TRUETYPE = &H4
Comments? |