Thread: [Solved] Capture a Font in a Variable
View Single Post
 
Old 05-30-2012, 08:23 PM
joatmon joatmon is offline Windows 7 64bit Office 2010 64bit
Novice
 
Join Date: May 2012
Posts: 14
joatmon is on a distinguished road
Default

I figured it out. Here is the code for anyone who might stumble on this:

Code:
Private Sub UserForm_Initialize()
    
    Dim myFont As String
    
    'Set fonts on controls based on version of Excel
    If Application.Version > 12 Then 'this is for Excel 2010
        myFont = "Chiller"
    Else: myFont = "Arial" 'older versions of Excel
    End If
    
    'Set the various controls
    Me.Label1.Font.Name = myFont
    'etc
Reply With Quote