The procedure for requesting AWR support has changed. Please read all about the new AWR product support process.
Page tree
Skip to end of metadata
Go to start of metadata
  • The fonts for graphs are type object and so they are handled differently than most other settings on graphs.

  • Below is a code snippet that shows how to get and set font information. You can make a project with any graph and run run this code to see labels, legend, and title font change.

  • You must add a new reference to get the StdFont type.

    1. Select Edit > References from the menus

    2. Select the "OLE Automation" reference. There might be more than one, if so choose the highest numbered one.

 ' Code Module
Sub Main
        Dim g As Graph
        Dim font As New StdFont
        Dim clr As Integer

'get graph
        Set g = Project.Graphs(1)

'get font information from graph axes 1 (x-axis) label font.
        Set font = g.Axes(1).LabelFont
'print out font information, note Color is separate.
        Debug.Print "Bold=" & font.Bold
        Debug.Print "Character Set=" & font.Charset
        Debug.Print "Italic=" & font.Italic
        Debug.Print "Name=" & font.Name
        Debug.Print "Size=" & font.Size
        Debug.Print "Strikethrough=" & font.Strikethrough
        Debug.Print "Underline=" & font.Underline
        Debug.Print "Weight=" & font.Weight
'color is a separate seting.
        Debug.Print "Color=" & g.Axes(1).LabelColor

'set new font characteristics.
        font.Name="Times New Roman"
        clr = 1234

'set graph items to use new font
        g.Axes(1).LabelFont = font
        g.Axes(1).LabelColor= clr
        g.Axes(1).GridlineLabelsColor= clr
        g.Legend.Color= clr
        g.TitleColor= clr

End Sub



  • The picture below is before the code is run.

  • The picture below is after the code is run.