HeaderFooterFont property

Microsoft Visio Developer Reference

HeaderFooterFont property

   Example   

Specifies the font used for the header and footer text.

Version added

2002

Syntax

fontRet = object.HeaderFooterFont
object.HeaderFooterFont = fontVal

fontRet

An IFontDisp object that represents the font of the header and footer text.

object

Required. An expression that returns a Document object.

fontVal

Required IFontDisp. An IFontDisp object representing the new font for the header and footer text.

Remarks

COM provides a standard implementation of a font object with the IFontDisp interface on top of the underlying system font support. The IFontDisp interface exposes a font object's properties and is implemented in the stdole type library as a StdFont object that can be created in Microsoft Visual Basic. The stdole type library is automatically referenced from all Visual Basic for Applications (VBA) projects in Visio.

To get information about the StdFont object that supports the IFontDisp interface:

  1. On the Tools menu, point to Macros, and then click Visual Basic Editor.
  1. On the View menu, click Object Browser.
  1. In the Project/Library list, click stdole.
  1. Under Classes, examine the class named StdFont.

For details about the IFontDisp interface, see the Microsoft Platform SDK on the Microsoft Developer Network (MSDN) Web site.

This is the equivalent of setting values in the Font box in the Choose Font dialog box (on the View menu, click Header and Footer, and then click Choose Font).

Example

The following sample code illustrates getting a reference to the current Font object and changing two of its attributes, its name and boldness.

Public Sub SetHeaderFooterFontNonBoldArial()
    Dim oStdFont As StdFont
    Set oStdFont = ThisDocument.HeaderFooterFont
    oStdFont.Name = "Arial"
    oStdFont.Bold = False
    Set ThisDocument.HeaderFooterFont = oStdFont
End Sub

After running this macro, the header and footer text are displayed in no-bold, Arial.