HOWTO: Invoke Word 6.0 Font Dialog for Word Object from VBLast reviewed: September 29, 1997Article ID: Q115985 |
The information in this article applies to:
- Standard and Professional Editions of Microsoft Visual Basic for Windows, version 3.0- Microsoft Word version 6.0
SUMMARYThis article shows by example how to show the Word font dialog directly in Visual Basic without using a Word macro. You cannot run macros in Word for Windows while a Word object is activated in a container application. When you attempt to run the ToolsMacro command, you are doing essentially the same thing as choosing Macro... from Word's Tools menu. When a Word object is active in a container, Word enables only those menu items that apply to editing in a container application; the Macro... item is not one of those. However, there are techniques you can use to run a Word macro while editing a Word object in Visual Basic, so if you want to know how to run Word macros, please see the following Microsoft Knowledge Base article:
ARTICLE-ID: Q116040 TITLE : HOWTO: Run a Word Macro While Editing a Word Object in VBIt contains three examples that show you:
MORE INFORMATION
Step-by-Step Example Calls Pre-Assigned Shortcut Key for Font DialogTo show the Word font dialog directly without using a Word macro, call a pre-assigned shortcut key. Because the shortcut key for showing the font dialog is CTRL+SHIFT+F, you can use the Visual Basic SendKeys function to activate it. Documentation for the shortcut keys is in the Word Help menu under the "Keyboard Shortcuts" topic. The following steps show the font dialog when the user clicks a Visual Basic command button:
Alternative Code for Step 3 to Hide the Formatting ToolbarIf the Word Formatting Toolbar is showing, the code shown above will actually select the Edit Font dialog box, so you'll need to hide the Toolbar first if this is the case. The following code demonstrates how to hide the Format Toolbar and show it again after the user clicks the command button and chooses a font:
|
Additional query words: officeinterop w_VBApp W_Word WM_OLE OA OLE
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |