Microsoft KB Archive/79696

= Using Shell Statement to Access MS-DOS Prompt from WinWord =

Article ID: 79696

Article Last Modified on 11/16/2006

-

APPLIES TO


 * Microsoft Word 1.0 Standard Edition
 * Microsoft Word 1.1 Standard Edition
 * Microsoft Word 1.1 Standard Edition
 * Microsoft Word 2.0 Standard Edition
 * Microsoft Word 2.0a
 * Microsoft Office Word 2003
 * Microsoft Word 2.0c
 * Microsoft Word 6.0 Standard Edition
 * Microsoft Word 6.0a
 * Microsoft Word 6.0c
 * Microsoft Word 95 Standard Edition
 * Microsoft Word 97 Standard Edition

-



This article was previously published under Q79696



SUMMARY
From within Microsoft Word, you can use the WordBasic or Visual Basic for Applications Shell statement to access the MS-DOS prompt. You can assign this macro to a key, a menu, or a button.



MORE INFORMATION
The following steps create a macro to access the MS-DOS prompt from within Word.

Word 97
 On the Tools menu, point to Macro, and then click Macros. In the Macro Name box, type dosprompt, and click Create. In the macro editing window, type the following macro text:

Shell &quot;command.com&quot;, 1

 On the File menu, click &quot;Close and Return to Microsoft Word.&quot;

For more information about adding macros to toolbars, menus, or keystrokes: from the Visual Basic Editor, click the Office Assistant, type &quot;add toolbar keyboard menu command,&quot; click Search, and then click to view the appropriate topic.

Word for Windows Versions 6.0, 7.0
 On the Tools menu, point to Macro, and then click Macros. In the Macro Name box, type dosprompt, and click Create.</li> In the macro editing window, type the following macro text:

Shell &quot;command.com&quot;, 1

</li> On the File menu, click Close. Click Yes when prompted to save changes to the macro.</li> On the Tools menu, point to Customize, and select the Keyboard, Menu, or Toolbar Category to assign this macro to a key combination, menu, or toolbar button.</li></ol>

Word for Windows Version 2.0
 From the Tools menu, choose Macro.</li> In the Macro Name box, type dosprompt, and then choose the Edit button.</li> In the macro editing window, type the following macro text:

Shell &quot;command.com&quot;, 1

</li> From the File menu, choose Close. Choose the Yes button when prompted to save changes to the macro.</li> From the Tools menu, choose Options, and select the Keyboard, Menu, or Toolbar Category to assign this macro to a key combination, menu or tool bar button.</li></ol>

For more information on the Shell statement, search for &quot;WordBasic Programming Language&quot; and &quot;Shell&quot; using the Help menu.

Word for Windows Version 1.x
 From the Macro menu, choose Edit.</li> In the Edit Macro Name box, type dosprompt, and press the OK button.</li>  In the macro editing window, type the following macro text: Sub MAIN Shell &quot;command.com&quot;, 1 End Sub Note: In the Shell line, the following arguments can be used:

0 for minimized window

1 for normal window

3 for maximized window

4 for deactivated window

</li> From the File menu, choose Close. Choose the Yes button when prompted to save changes to the macro.</li> From the Macro menu, you can choose the Assign to Key, or Assign to Menu commands to assign this macro to a key sequence or menu.</li></ol>

<div class="references_section">