Name

form.Font [= setting]

Synopsis

Sets or returns the Font object used by new controls added at runtime. To change the font of existing controls in code, use the Font property of the control. For example, the following code sets a large font size for both existing controls and runtime controls:

    Private Sub UserForm_Initialize(  )
        Dim c As Control
        ' Set size of font for runtime controls.
        Me.Font.Size = 24
        ' Set size of font for design time controls
        For Each c In Me.Controls
            c.Font.Size = 24
        Next
    End Sub

Get Programming Excel with VBA and .NET now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.