Macro to Run Macro or Insert Glossary, as in Word for MS-DOSLast reviewed: July 30, 1997Article ID: Q99956 |
The information in this article applies to:
SUMMARYIn Microsoft Word for MS-DOS, the F3 key is used to run a macro or insert a glossary entry whose name matches the word to the left of the insertion point. The following macro in Word for Windows can be assigned to the F3 key to achieve the same behavior. WARNING: ANY USE BY YOU OF THE CODE PROVIDED IN THIS ARTICLE IS AT YOUR OWN RISK. Microsoft provides this macro code "as is" without warranty of any kind, either express or implied, including but not limited to the implied warranties of merchantability and/or fitness for a particular purpose.
Sub MAIN WordLeft 1, 1 'Select word to left of insertion point name$ = Selection$() 'Assign word to a variable If GetGlossary$(name$, 0) <> "" Then 'Test for glossary entry EditClear EditGlossary .Name = name$ 'If true, insert glossary entry Else On Error Goto errors exe = IsExecuteOnly("Global:" + name$) EditClear ToolsMacro .Name = name$, .Run 'Run global macro if it existsEnd If errors: If err = 511 Then Print "No macro or glossary exists by the name" End SubThe above macro selects the word to the left of the insertion point and assigns the text to the name$ string. If a global glossary entry exists with the same name, the contents are inserted into the document window. If a glossary entry does not exist with the specified name, then the macro checks whether the name refers to a macro. If a macro with the specified name is found, the ToolsMacro statement runs the macro. Reference(s): "Using WordBasic" by WexTech Systems, Inc., and Microsoft Corporation, Microsoft Press, 1992
|
KBCategory: kbmacro
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |