SetFont Example

Using Programming Languages other than VBA

Sub Example_SetFont()
	' This example finds the font information for the active text style.
	' It then changes the font to bold.

	Dim typeFace As String
	Dim Bold As Boolean
	Dim Italic As Boolean
	Dim charSet As Long
	Dim PitchandFamily As Long

	ThisDrawing.ActiveTextStyle.GetFont typeFace, Bold, Italic, charSet, PitchandFamily

	MsgBox "The current text style has the following font properties:" & vbCrLf _
			& "Typeface: " & typeFace & vbCrLf _
			& "Bold: " & Bold & vbCrLf _
			& "Italic: " & Italic & vbCrLf _
			& "Character set: " & charSet & vbCrLf _
			& "Pitch and Family: " & PitchandFamily
		
	' Change the bold property
	Bold = Not Bold

	ThisDrawing.ActiveTextStyle.SetFont typeFace, Bold, Italic, charSet, PitchandFamily
	MsgBox "The current text style has the following font properties:" & vbCrLf _
			& "Typeface: " & typeFace & vbCrLf _
			& "Bold: " & Bold & vbCrLf _
			& "Italic: " & Italic & vbCrLf _
			& "Character set: " & charSet & vbCrLf _
			& "Pitch and Family: " & PitchandFamily
		
	' Reset the font
	Bold = Not Bold
	ThisDrawing.ActiveTextStyle.SetFont typeFace, Bold, Italic, charSet, PitchandFamily

End Sub

 

   Comments?