Creating a Dialog Launcher
You've probably seen the small button that appears in the lower-right corner of some Ribbon groups. In Word's Home tab, for example, the button appears in the Clipboard, Font, Paragraph, and Styles groups. In each case, clicking the button opens a dialog box. In the Font group, for example, clicking the button opens the Font dialog box.
This button is called a dialog box launcher, and you can add them to your custom Ribbon groups. Your custom dialog box launchers can open any of the application's built-in dialog boxes or a custom dialog box that you've built in the Visual Basic Editor.
You begin with an empty <dialogBoxLauncher> element:
<dialogBoxLauncher> </dialogBoxLauncher>
Between these elements, you add a single <button> element:
<dialogBoxLauncher> <button id="dlLaunchInsertHyperlinkDialog" onAction="Module1.dlLaunchInsertHyperlinkDialog_OnAction" /> </dialogBoxLauncher>
Here's the code for the LaunchInsertHyperlinkDialog macro:
Sub dlLaunchInsertHyperlinkDialog_OnAction(ByVal control As IRibbonControl) Dialogs(wdDialogInsertHyperlink).Show End Sub
In this tutorial:
- Creating Custom Controls
- Common Control Attributes
- Creating a Button
- Creating a Menu
- Creating a Split Button
- Creating a Check Box
- Creating a Toggle Button
- Creating a Drop-Down List
- Creating a Gallery
- Creating a Combo Box
- Creating a Dialog Launcher
- Working with Ribbon Commands at Runtime
- Initializing Controls
- Resetting Controls
- Getting and Changing Control Values