OLE Automation: Specifying a Command Button from Visual Basic |
Q105581
Using a Microsoft Visual Basic application, it is possible to run a
WordBasic instruction with command button parameters. Boolean "true"
and "false" values are used to specify command buttons.
For example:
ToolsMacro .Name = "MacroName", .Run
To use this instruction in a Visual Basic procedure, you would write:
WordObj.ToolsMacro "MacroName", True
The "True" value is the Visual Basic equivalent to choosing/specifying
the Run command button. You can use the "False" value or omit a
command button argument to not choose a command button. When calling
WordBasic instructions from Visual Basic you must identify WordBasic
arguments by position using commas as placeholders.
Sub Command1_Click ()
Dim WordObj As Object
Set WordObj = CreateObject("Word.Basic")
WordObj.ToolsMacro "Test", , True
End Sub
If you remove the comma before True, the instruction will run the Test
macro. For example:
WordObj.ToolsMacro "Test", True
Additional query words: 6.0 ole automation word basic word6 7.0 word95 word7 winword object position visual true
Keywords : kbole
Issue type :
Technology :
|
Last Reviewed: November 4, 2000 © 2001 Microsoft Corporation. All rights reserved. Terms of Use. |