Use WithEvents to perform an action when you change any font properties of a specific control or form. Make sure you set the OLE Automation reference in the References dialog:
' Declaration sectionPrivate WithEvents fntAny As StdFontPrivate Sub fntAny_FontChanged(ByVal _ PropertyName As String) Select Case PropertyName Case "Name" ' Perform specific action Case "Size" ' Perform specific action Case "Italic" ' Perform specific action Case "Bold" ' Perform specific action Case "Underline" ' Perform specific action '... '... ' Similarly, you can extend the ' functionality for each font property. End SelectEnd Sub
You only have to assign any form or control’s Font reference to fntAny. For example, if you want to trap the changes in the form’s font attributes, add this code to the Form_Load event:
Set fntAny = Me.Font' If a control, then Control.Font
Charlie has over a decade of experience in website administration and technology management. As the site admin, he oversees all technical aspects of running a high-traffic online platform, ensuring optimal performance, security, and user experience.























