Word Macro Example


The following macro, suitably modified for your path names, can be used to launch Wilbur and search for the text under the cursor:

Sub MAIN

SelectCurWord
Shell "g:\wilbur\WinRel\wilbur.exe " +
 "d:\wilbur\text.wilbur " + Selection$()

SendKeys "{enter}"

End Sub

or if you have spaces in your path names you will need the more complicated form:

Sub MAIN

SelectCurWord

Shell Chr$(34) + "g:\wilbur\\wilbur.exe" +
  Chr$(34) + " " +
  "'d:\wilbur\text.wilbur' " +
  Selection$()

SendKeys "{enter}"

End Sub

Please be careful to get the spaces after the path names included correctly and don't include the line breaks after the '+' signs. If you are running Word 97, please add "WordBasic." in front of the SelectCurWord, Shell, Selection$ and SendKeys commands. (e.g. WordBasic.SelectCurWord)

Use the Tools/Macro command to create the macro and give it a name like Wilbur. Then use the Tools/Customize command to assign a hot key (Ctrl+Alt+W perhaps) to the macro and you are in business.


Copyright © 1999 RedTree Development Inc. All rights reserved.
Information in this document is subject to change without notice.
Other products and companies referred to herein are trademarks or registered trademarks of their respective companies or mark holders.