English | Русский | UserForms-Class-ALL
This repository contains a VBA implementation of a customizable slider control that can be used in Excel UserForms. The slider class provides a more flexible and feature-rich alternative to the standard scrollbar control.
- Features
- Components
- Installation
- Quick Start
- Main Functions
- Working with Controls
- Style Configuration
- Troubleshooting
- Customizable slider appearance (size, colors, orientation)
- Support for both horizontal and vertical orientations
- Adjustable minimum and maximum values
- Step size control for precise value selection
- Event handling for value changes
- Smooth visual updates
- Three-state functionality (unchecked, checked, indeterminate)
- Cyclic/non-cyclic state switching
- Ability to set/get state by text
- Method to get all available states
- Improved error handling and validation
- Ability to set font name and size factor
- Ability to get/set current icon
- Method to set color for specific state
- Method to reset to initial state
clsSlider.cls: The main slider class implementationfrmTestClass.frm: Test form demonstrating usagemodShowForms.bas: Module containing form display functions- Documentation in the
docs/folder: docs/technical_documentation_eng.md- Technical documentation in Englishdocs/technical_documentation_rus.md- Technical documentation in Russiandocs/user_guide_eng.md- User guide in Englishdocs/user_guide_rus.md- User guide in Russiandocs/implementation_examples_eng.md- Implementation examples in Englishdocs/implementation_examples_rus.md- Implementation examples in Russian
- Open the
slider_v4.xlsmworkbook in Excel - Import the VBA files into your project:
vba-files/Class/clsSlider.clsvba-files/Form/frmTestClass.frmvba-files/Module/modShowForms.bas
- Start using the slider class in your forms
' In the form module
Dim Slider As clsSlider
Private Sub UserForm_Initialize()
' Create an instance of the slider class
Set Slider = New clsSlider
' Initialize the slider with default parameters
Call Slider.Initialize(Me.Label1, 50, 0, 100, True)
End Sub- Slider Initialization: The
Initializemethod allows setting the initial value, minimum and maximum values, and configuring appearance - Range Management: Ability to configure minimum and maximum values
- Orientation Configuration: Support for horizontal and vertical orientations
- Event Handling: Support for value change and click events
- Smooth Updates: Visual representation of value changes
The clsSlider class uses a Label control as the slider track with capabilities:
- Setting initial value
- Configuring minimum and maximum values
- Handling drag events
- Displaying value label with customizable positions
The class allows customization of:
- Track colors (empty/filled portions)
- Slider button colors
- Value label colors
- Background colors
- Fonts and text sizes
Example of color configuration:
' Configure colors during initialization
Slider.Initialize Me.Label1, 50, 0, 100, True, , RGB(200, 200, 200), RGB(0, 100, 200)- Ensure Microsoft Forms 2.0 Object Library is enabled in references
- Check that the Label control is 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.
