• New? Start here
  • Excel and VBA Training Resources
    • Premium Courses
    • Books
    • Cheat Sheets
    • Blog Archives
  • VBA Code Generator
  • Academy Login

Power Spreadsheets

Excel and VBA tutorials and training. Learn how to use Microsoft Excel and Visual Basic for Applications now.

Excel VBA ActiveX Label Font Color in 2 Easy Steps (+ Free Easy-To-Adjust Excel Workbook Example)

By J.A. Gomez J.A. Gomez from Power Spreadsheets

Excel VBA ActiveX Label Font Color in 2 Easy Steps (+ Free Easy-To-Adjust Excel Workbook Example)In this Excel VBA ActiveX Label Font Color Tutorial, you learn how to change an ActiveX Label's font color with Excel macros (when the ActiveX Label is in a worksheet).

This Excel VBA ActiveX Label Font Color Tutorial:

  • Applies to ActiveX Labels in a worksheet. These are the Labels you insert (for example) through the Insert dropdown in the Developer tab of the Excel Ribbon.
  • Doesn't apply to the following:
    • Chart labels.
    • Labels in a UserForm.
      • These are the Labels you insert (for example) through the Visual Basic Editor's (VBE's) Toolbox.
      • If you want to learn how to change a UserForm Label's font color with Excel macros, I suggest you read my Excel VBA UserForm Label Font Color Tutorial. I link to this Tutorial in the Related Excel Macro and VBA Training Materials and Resources Section below.

This Excel VBA ActiveX Label Font Color Tutorial is accompanied by an Excel workbook with the data and VBA code I use when describing the step-by-step process below. Get this example workbook (for free) by clicking the button below.


Get immediate free access to the Excel VBA ActiveX Label Font Color workbook example

The VBA code in the Excel workbook that accompanies this Excel VBA ActiveX Label Font Color Tutorial is (always) stored in the Visual Basic Editor (VBE). If you don't know how to work with the VBE, I suggest you read my Visual Basic Editor (VBE) Tutorial. I link to this Tutorial in the Related Excel Macro and VBA Training Materials and Resources Section below.

Table of Contents

  • Related Excel Macro and VBA Training Materials and Resources
  • The VBA ActiveX Label Font Color Snippet Template/Structure
  • The Example Before VBA ActiveX Label Font Color
  • Step 1: Refer to ActiveX Label
    • Step 1 Example
  • Step 2: Set the Value of the ForeColor Property
    • Step 2 Example
  • Download the VBA ActiveX Label Font Color Example Workbook
  • Related Excel Macro and VBA Training Materials and Resources

Related Excel Macro and VBA Training Materials and Resources

The following Excel Macro and VBA Tutorials may help you better understand and implement the contents below.

  • Tutorials about general macro and VBA constructs and structures:
    • Tutorials for Beginners:
      • Excel Macros: Click here to open.
      • Excel VBA: Click here to open.
    • Enable macros in Excel: Click here to open.
    • Work with the Visual Basic Editor (VBE): Click here to open.
    • Create Sub procedures: Click here to open.
    • Refer to objects (click here to open), including sheets (click here to open).
    • Work with:
      • Properties: Click here to open.
      • Data types: Click here to open.
      • Functions: Click here to open.
  • Tutorials with practical VBA applications and macro examples:
    • Activate workbook: Click here to open.
    • Work with font characteristics: Click here to open.
    • Create UserForms: Click here to open.

This Excel VBA ActiveX Label Font Color Tutorial is part of a more comprehensive series of Excel VBA Font Color Tutorials.

  • Excel VBA Font Color Index in 2 Easy Steps: Click here to open.
  • Excel VBA Font Color RGB in 2 Easy Steps: Click here to open.
  • Excel VBA Font Color HEX in 5 Easy Steps: Click here to open.
  • Excel VBA Change Font Color Based on Cell Value in 4 Easy Steps: Click here to open.
  • Excel VBA Change Font Color for Part of Text in 8 Easy Steps: Click here to open.
  • Excel VBA Text Box Font Color in 2 Easy Steps: Click here to open.
  • Excel VBA ActiveX Text Box Font Color in 2 Easy Steps: Click here to open.
  • Excel VBA UserForm Text Box Font Color in 2 Easy Steps: Click here to open.
  • Excel VBA Chart Data Label Font Color in 4 Easy Steps: Click here to open.
  • Excel VBA UserForm Label Font Color in 2 Easy Steps: Click here to open.

You can find more Excel and VBA Tutorials in the organized Tutorials Archive: Click here to visit the Archives.

If you want to learn how to automate Excel (and save time) by working with macros and VBA, you may be interested in the following Premium Excel Macro and VBA Training Materials:

  • Premium Courses at the Power Spreadsheets Academy: Click here to open.
  • Books at the Power Spreadsheets Library: Click here to open.
  • VBA Cheat Sheets: Click here to open.

If you want to save time when working with macros and VBA, you may be interested in AutoMacro: Click here to learn more about AutoMacro (affiliate link). AutoMacro is an add-in for VBA that installs directly into the VBE. Depending on the version, AutoMacro comes loaded with:

  • Code generators.
  • An extensive code library.
  • The ability to create your own code library.
  • Advanced coding tools.

If you need consulting services, you may want to consider working with ExcelRescue. ExcelRescue is my usual suggestion for people who (like you) may need help with Excel tasks/projects: Click here to visit ExcelRescue (affiliate link).


Get immediate free access to the Excel VBA ActiveX Label Font Color workbook example

The VBA ActiveX Label Font Color Snippet Template/Structure

The following is the VBA ActiveX Label font color snippet template/structure I explain (step-by-step) in the Sections below.

'Source: https://powerspreadsheets.com/
'More information: https://powerspreadsheets.com/activex-label-font-color/
WorkbookObjectReference.WorksheetObjectReference.ActivexLabelCodeName.ForeColor = NewForeColorValue


Get immediate free access to the Excel VBA ActiveX Label Font Color workbook example

The Example Before VBA ActiveX Label Font Color

This Excel VBA ActiveX Label Font Color Tutorial is accompanied by an Excel workbook with the data and VBA code I use when describing the step-by-step process below. Get this example workbook (for free) by clicking the button below.


Get immediate free access to the Excel VBA ActiveX Label Font Color workbook example

The VBA code in the Excel workbook that accompanies this Excel VBA ActiveX Label Font Color Tutorial is (always) stored in the Visual Basic Editor (VBE). If you don't know how to work with the VBE, I suggest you read my Visual Basic Editor (VBE) Tutorial. I link to this Tutorial in the Related Excel Macro and VBA Training Materials and Resources Section above.

The example worksheet has an ActiveX Label with the text “Set this ActiveX Label's Font Color”.

This is the ActiveX Label the VBA ActiveX Label font color example macro I create (by following the step-by-step process below) works with. In other words: This is the ActiveX Label where the example macro (when executed) sets the font color.

The following image displays the example worksheet before I execute the VBA ActiveX Label font color example macro.

Example Excel workbook before VBA ActiveX Label font color example macro


Get immediate free access to the Excel VBA ActiveX Label Font Color workbook example

Step 1: Refer to ActiveX Label

Refer to the ActiveX Label whose font color you want to set.

In other words: Create a VBA expression that returns an ActiveX Label control (object) representing the ActiveX Label whose font color you want to set.

If your procedure (setting the ActiveX Label's font color) is outside the (Sheet) Class module for the applicable worksheet, consider explicitly including the following references to create a fully qualified object reference returning a Worksheet object (representing the worksheet where the ActiveX Label is):

  1. A reference to the applicable workbook. The following VBA constructs (among others) may return a Workbook object:
    • The Application.ThisWorkbook property.
    • The Application.Workbooks and Workbooks.Item properties.
    • The Application.ActiveWorkbook property.
  2. A reference to the applicable worksheet. The following VBA constructs (among others) may return a Worksheet object:
    • The Workbook.Sheets and Sheets.Item properties.
    • The Workbook.Worksheets and Worksheets.Item properties.
    • The Application.ActiveSheet property.

As a general rule, you can:

  • Use the ActiveX Label's codename to refer to the applicable ActiveX Label control (object) inside the applicable worksheet.
  • Find (and change) the ActiveX Label's codename ((Name) property) in the applicable Properties Window.
ActiveX Label Name in Properties Window

The basic expression structure/template to refer to the ActiveX Label is as follows:

'Source: https://powerspreadsheets.com/
'More information: https://powerspreadsheets.com/activex-label-font-color/
WorkbookObjectReference.WorksheetObjectReference.ActivexLabelCodeName


Get immediate free access to the Excel VBA ActiveX Label Font Color workbook example

Step 1 Example

I:

  • Refer to the Label codenamed “ActivexLabelFontColor” in the “ActiveX Label Font Color” worksheet inside the workbook where the procedure is stored.
  • Work with the following VBA constructs to obtain an ActiveX Label control (object) representing this ActiveX Label:
    • The Application.ThisWorkbook property: ThisWorkbook.
    • The Workbook.Worksheets and Worksheets.Item properties: Worksheets(“ActiveX Label Font Color”).
    • The ActiveX Label's codename: ActivexLabelFontColor.
'Source: https://powerspreadsheets.com/
'More information: https://powerspreadsheets.com/activex-label-font-color/
ThisWorkbook.Worksheets("ActiveX Label Font Color").ActivexLabelFontColor


Get immediate free access to the Excel VBA ActiveX Label Font Color workbook example

Step 2: Set the Value of the ForeColor Property

Do the following to set the applicable ActiveX Label's font color with the ForeColor property:

(1) Start with the ActiveX Label control (object) reference you created in step #1:

'Source: https://powerspreadsheets.com/
'More information: https://powerspreadsheets.com/activex-label-font-color/
WorkbookObjectReference.WorksheetObjectReference.ActivexLabelCodeName

(2) Refer to the ForeColor property.

'Source: https://powerspreadsheets.com/
'More information: https://powerspreadsheets.com/activex-label-font-color/
WorkbookObjectReference.WorksheetObjectReference.ActivexLabelCodeName.ForeColor

(3) Set the value of the ForeColor property.

The ForeColor property specifies the ActiveX Label's font color as a value of the Long data type representing the applicable red, green, and blue components.

  • Consider working with the RGB function to set the value of the of the ForeColor property by specifying the applicable red, green, and blue components.
  • If you don't know how to work with the RGB function, I suggest you read my Excel VBA Font Color RGB Tutorial I link to in the Related Excel Macro and VBA Training Materials and Resources Section above.

You can (also) consider setting the ForeColor property to any of VBA's color constants:

  • vbBlack.
  • vbRed.
  • vbGreen.
  • vbYellow.
  • vbBlue.
  • vbMagenta.
  • vbCyan.
  • vbWhite.
'Source: https://powerspreadsheets.com/
'More information: https://powerspreadsheets.com/activex-label-font-color/
WorkbookObjectReference.WorksheetObjectReference.ActivexLabelCodeName.ForeColor = NewForeColorValue


Get immediate free access to the Excel VBA ActiveX Label Font Color workbook example

Step 2 Example

I use the RGB function to set the value of the ForeColor property (ForeColor = RGB(0, 128, 55)). I specify the Red, Green, and Blue arguments of the RGB function as follows:

  • Red: 0.
  • Green: 128.
  • Blue: 55.
'Source: https://powerspreadsheets.com/
'More information: https://powerspreadsheets.com/activex-label-font-color/
ThisWorkbook.Worksheets("ActiveX Label Font Color").ActivexLabelFontColor.ForeColor = RGB(0, 128, 55)

The full VBA ActiveX Label font color example macro is as follows:

Sub ActivexLabelFontColor()
    'Source: https://powerspreadsheets.com/
    'More information: https://powerspreadsheets.com/activex-label-font-color/
     
    'Do the following:
        'Step 1: Refer to the ActivexLabelFontColor ActiveX Label in the "ActiveX Label Font Color" worksheet in this workbook
        'Step 2: Use the RGB function to set the value of the ForeColor property. Specify the red, green, and blue components of the color as follows:
            'Red: 0
            'Green: 128
            'Blue: 55
    ThisWorkbook.Worksheets("ActiveX Label Font Color").ActivexLabelFontColor.ForeColor = RGB(0, 128, 55)
     
End Sub

The following GIF illustrates the effects of using the VBA ActiveX Label font color example macro.

Example: Set Excel VBA ActiveX Label Font Color with macros


Get immediate free access to the Excel VBA ActiveX Label Font Color workbook example

Download the VBA ActiveX Label Font Color Example Workbook

This Excel VBA ActiveX Label Font Color Tutorial is accompanied by an Excel workbook with the data and VBA code I use when describing the step-by-step process above. Get this example workbook (for free) by clicking the button below.


Get immediate free access to the Excel VBA ActiveX Label Font Color workbook example

The VBA code in the Excel workbook that accompanies this Excel VBA ActiveX Label Font Color Tutorial is (always) stored in the Visual Basic Editor (VBE). If you don't know how to work with the VBE, I suggest you read my Visual Basic Editor (VBE) Tutorial. I link to this Tutorial in the Related Excel Macro and VBA Training Materials and Resources Section above.

Related Excel Macro and VBA Training Materials and Resources

The following Excel Macro and VBA Tutorials may help you better understand and implement the contents above.

  • Tutorials about general macro and VBA constructs and structures:
    • Tutorials for Beginners:
      • Excel Macros: Click here to open.
      • Excel VBA: Click here to open.
    • Enable macros in Excel: Click here to open.
    • Work with the Visual Basic Editor (VBE): Click here to open.
    • Create Sub procedures: Click here to open.
    • Refer to objects (click here to open), including sheets (click here to open).
    • Work with:
      • Properties: Click here to open.
      • Data types: Click here to open.
      • Functions: Click here to open.
  • Tutorials with practical VBA applications and macro examples:
    • Activate workbook: Click here to open.
    • Work with font characteristics: Click here to open.
    • Create UserForms: Click here to open.

This Excel VBA ActiveX Label Font Color Tutorial is part of a more comprehensive series of Excel VBA Font Color Tutorials.

  • Excel VBA Font Color Index in 2 Easy Steps: Click here to open.
  • Excel VBA Font Color RGB in 2 Easy Steps: Click here to open.
  • Excel VBA Font Color HEX in 5 Easy Steps: Click here to open.
  • Excel VBA Change Font Color Based on Cell Value in 4 Easy Steps: Click here to open.
  • Excel VBA Change Font Color for Part of Text in 8 Easy Steps: Click here to open.
  • Excel VBA Text Box Font Color in 2 Easy Steps: Click here to open.
  • Excel VBA ActiveX Text Box Font Color in 2 Easy Steps: Click here to open.
  • Excel VBA UserForm Text Box Font Color in 2 Easy Steps: Click here to open.
  • Excel VBA Chart Data Label Font Color in 4 Easy Steps: Click here to open.
  • Excel VBA UserForm Label Font Color in 2 Easy Steps: Click here to open.

You can find more Excel and VBA Tutorials in the organized Tutorials Archive: Click here to visit the Archives.

If you want to learn how to automate Excel (and save time) by working with macros and VBA, you may be interested in the following Premium Excel Macro and VBA Training Materials:

  • Premium Courses at the Power Spreadsheets Academy: Click here to open.
  • Books at the Power Spreadsheets Library: Click here to open.
  • VBA Cheat Sheets: Click here to open.

If you want to save time when working with macros and VBA, you may be interested in AutoMacro: Click here to learn more about AutoMacro (affiliate link). AutoMacro is an add-in for VBA that installs directly into the VBE. Depending on the version, AutoMacro comes loaded with:

  • Code generators.
  • An extensive code library.
  • The ability to create your own code library.
  • Advanced coding tools.

If you need consulting services, you may want to consider working with ExcelRescue. ExcelRescue is my usual suggestion for people who (like you) may need help with Excel tasks/projects: Click here to visit ExcelRescue (affiliate link).

guest
guest
1 Comment
Most Voted
Newest Oldest
Inline Feedbacks
View all comments

I publish a lot of Tutorials and Training Resources about Microsoft Excel and VBA. Here are some of my most popular Excel Training Resources:

  1. Free Excel VBA Email Course
  2. Excel Macro Tutorial for Beginners
  3. Excel Power Query (Get and Transform) Tutorial for Beginners
  4. Excel Keyboard Shortcut Cheat Sheet
  5. Excel Resources
About

Contact

Terms and Conditions

Privacy Policy

Limit of Liability and Disclaimer of Warranty

Affiliate Disclosure

Copyright © 2015–2022 PDS Intelligence Pte. Ltd. All rights reserved.
Excel ® is a registered trademark of the Microsoft Corporation. Power Spreadsheets is not affiliated with the Microsoft Corporation.