About Controls

Controls are typically used as entry points into your code. To perform actions, end users click a button on a toolbar or choose an item in a combo box on a dialog. Using VBA, you can add controls to your Word and Excel solutions in three ways: by adding them to the CommandBar (toolbar or menu); by creating a dialog box and adding ActiveX controls to a UserForm; or by adding these controls to the document. With VSTO, instead of adding ActiveX controls, you can add a variety of Windows Forms controls to a Windows Form, the task pane, or directly on the document. Using VSTO, you must add ActiveX controls to the Com-mandBar programmatically; you cannot add them at design time.

VSTO extends a number of objects in the Word and Excel object models, such as a Bookmark object, essentially turning them into controls. These controls, called host controls, are described in greater detail in Chapters 6 and 7. In this chapter, we look at the various ways you can customize the user interface in Word and Excel by adding controls to your Word and Excel solutions using VSTO.

0 0

Post a comment