UserForms are programmable containers for ActiveX controls. They enable you to build customized windows to serve as a user interface in any VBA application. UserForms are similar to other VBA objects in that they have properties, methods, and events that you use to control the appearance and behavior of your interface window; but the main function of a UserForm is to serve as a container for other ActiveX controls. UserForms are part of the VBA object library, and therefore, are available to use in all MS Office applications (Excel, Word, PowerPoint, and so on). In this chapter you will learn how to design UserForms using ActiveX controls for inclusion in your VBA programs.
In this chapter I will examine:
• The Option Button Control
• The Scroll Bar Control
• The Frame Control
• The RefEdit Control
• The MultiPage Control
• The List Box and Combo Box Controls
• Custom Data Types and Enumerations
The Blackjack game.
The Blackjack game.
DesiGNiNG Forms witH VBA
If you have previous programming experience in Visual Basic (even as a novice), then User-Forms (hereafter referred to as a VBA form or just form when used in the general sense) will be very familiar, because they will remind you of Visual Basic forms. If you have never used Visual Basic, then VBA forms will probably look just like another Window; however, VBA forms are not quite VB forms or regular windows because they don't have as many features. For example, there are no minimize and maximize buttons in the upper-right corner. Also, there are fewer properties and methods available for altering the appearance and behavior of the UserForm object. Nonetheless, VBA forms are invaluable for adding custom user interfaces to your applications.
Forms are included in VBA to allow programmers to build custom user interfaces with their office applications. Up to this point, input from the user via dialog boxes has been limited to InputBox() and MsgBox() functions. Because forms can be customized using a number of ActiveX controls, they greatly extend the ability of VBA programmers to collect user input.
Was this article helpful?
Discover the 100 Legal Secrets Las Vegas Professional Blackjack Gamblers Use to Make Literally Thousands of Dollars Every Week... I'll Teach You the Ultimate Step-by-Step Blackjack System, Casino's Don't Want You to Know About! That's Right, I'll show you step-by-step how to have the blackjack odds in your favor, guaranteed!