The information in this article applies to:
SUMMARYThe Microsoft Windows operating system provides two routines that can be called by Microsoft Word for Windows to get the Windows and the Windows System directories. MORE INFORMATIONWord 6.x, 7.xWhen Windows starts, it sets a special environment variable called "windir" with the path from which Windows was started. You can use the following macro instruction to post the Windows directory to a message box.MsgBox Environ$("windir")However, there is no argument to return the Windows System directory when using this method. The following examples use Windows API calls to return both the Windows and Windows System directories. Word 7.xWARNING: 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.Create a macro and place these declarations above the Sub Main routine:
Word 6.x
Windows API syntax
-and-
In both cases, the result is returned in the string "lpBuffer," whose
maximum size is specified by "nSize." Each routine returns the length
of the string copied into lpBuffer.
REFERENCES"Microsoft Windows Programmer's Reference," pages 4-210, 4-229 Additional query words: 1.0 1.10a 2.0 2.0a-CD 2.0b word6 7.0 word95 word7 winword 6.0 winword2
Keywords : kbmacro kbmacroexample |
Last Reviewed: October 18, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |