English | Русский | UserForms-Class-ALL
This repository contains a VBA class library implementation that provides modern styling for MSForms controls in Excel applications. The class enhances the appearance of UserForms with contemporary design elements, animations, and improved visual feedback.
- Features
- Components
- Installation
- Quick Start
- Main Functions
- Working with Controls
- Style Configuration
- Troubleshooting
- Modern Design: Apply sleek, contemporary styling to various MSForms controls
- Focus Animation: Visual feedback when controls gain focus with animated elements
- Color Customization: Configure colors for different control states (active/inactive)
- Icon Support: Add icons to controls using the Segoe MDL2 Assets font
- Clear Buttons: Automatic clear buttons for textboxes and combo boxes
- Toggle Switches: Modern toggle switch styling for checkboxes and option buttons
- Responsive Labels: Labels that animate when controls receive input
clsModernStyle.cls: The main class implementationfrmTest.frm: Test form demonstrating usagemodShowForms.bas: Module containing form display functions- Documentation in the
docs/folder:docs/technical_documentation_en.md- Technical documentation in English
docs/technical_documentation_ru.md- Technical documentation in Russiandocs/user_guide_en.md- User guide in Englishdocs/user_guide_ru.md- User guide in Russiandocs/implementation_examples_en.md- Implementation examples in Englishdocs/implementation_examples_ru.md- Implementation examples in Russian
- Download the
clsModernStyle.clsfile from thevba-files/Class/directory - Import the class into your VBA project
- Ensure you have the Microsoft Forms 2.0 Object Library referenced in your project
' Create an instance of clsModernStyle class
Set style = New clsModernStyle
' Initialize the styling for your UserForm
style.Initialize Me ' where Me is the UserForm
' The class automatically applies modern styling to all compatible controls on the form- Styling Initialization: The
Initializemethod applies modern styling to all compatible controls on the form - Color Configuration: Ability to configure colors for various controls and states
- Icon Support: Using icons from the Segoe MDL2 Assets font for various controls
- Animations: Visual feedback during interaction with controls
- Clear Buttons: Automatic clear buttons for textboxes and combo boxes
The clsModernStyle class supports styling of the following controls:
- TextBox
- ComboBox
- ListBox
- CheckBox
- OptionButton
- Frame
- Label
- CommandButton
For each control type, appropriate styling is implemented, taking into account the specific interaction features with the user.
The class allows customization of:
- Colors for various controls
- Fonts and text sizes
- Visibility and enabled state of controls
- Interaction behavior (animations, effects)
For color configuration, you can use initialization parameters:
' Initialize with custom colors
Set style = New clsModernStyle
style.Initialize Me, _
ColorBarTitleOn:=RGB(0, 100, 200), _
ColorBarTitleOff:=RGB(120, 120, 120), _
ColorBarBottomOn:=RGB(0, 100, 200), _
ColorBarBottomOff:=RGB(180, 180, 180), _
ColorBackGroundOn:=RGB(255, 255, 255), _
ColorBackGroundOff:=RGB(245, 245, 245)- Ensure Microsoft Forms 2.0 Object Library is enabled in references
- Check that controls are added before calling the Initialize method
- Ensure the MultiUse property is set to True for the class
- Check that control events are not overloaded with other handlers
- Ensure control properties are not changed manually while the class is running
- Verify that the class is not initialized multiple times
This project is licensed under the Apache License 2.0 - see the LICENSE file for details.
