Microsoft Office Tutorials and References
In Depth Information
Lesson 13: Using Embedded Controls
using embedded Controls
You’ve seen many ways to run macros, including using keyboard shortcuts, the Macro
dialog box, and the Visual Basic Editor. This lesson shows you how to execute VBA code by
clicking a button or other object that you can place onto your worksheet to make your
macros easier to run.
Working WiTH forMs conTrols And AcTiVEx conTrols
A control is an object such as a Button, Label, TextBox, OptionButton, or CheckBox that you
can place onto a UserForm (covered in Lessons 18, 19, and 20) or embed onto a worksheet.
VBA supports these and more controls, which provide an intuitive way for you to run your
macros quickly and with minimal effort.
There are two generations of controls. Forms controls are the original controls that came with
Excel starting with version 5. Forms controls are still fully supported in all later versions of
Excel, including Excel 2010. Forms controls are more stable, simpler to use, and more
integrated with Excel. For example, you can place a Forms control onto a Chart sheet, but you
cannot do that with an ActiveX control.
Generally, ActiveX controls from the Control Toolbox are more flexible with their extensive
properties and events. You can customize their appearance, behavior, fonts, and other
characteristics. You can also control how different events are responded to when an ActiveX control is
associated with those events.
Forms controls have macros that are assigned to them. ActiveX controls run procedures that are
based on whatever event(s) they have been programmed to monitor. Not that ActiveX controls
look all the more scintillating, but Forms controls have an elementary appearance that will never
win them first prize in a beauty contest. But, both kinds of controls serve their purposes well as
Microsoft intended, and they are here to stay with Excel for the foreseeable future.
Search JabSto ::

Custom Search