Word Macro ExampleThe following macro, suitably modified for your path names, was submitted by Keith Ratner and should work with Word 2000. It will launch Wilbur and search for the word under the cursor: Sub Main()
Selection.Words(1).Select
While Right(Selection.Text, 1) = " "
Selection.MoveLeft Unit:=wdCharacter, Count:=1, Extend:=wdExtend
Wend
x = Shell("C:\Program Files\RedTree\Wilbur\wilbur.exe " + "'C:\Program
Files\RedTree\Wilbur\indexes\proposal root.wil' " + Selection.Text,
vbMaximizedFocus)
SendKeys "{enter}"
End Sub
Below is the original macro used with earlier versions of Word: 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. |