The information in this article applies to:
SUMMARY
This article describes how to use the WordBasic SetProfileString
statement in Word for Windows to add to or modify information in the
Windows WIN.INI file. This article also describes a limitation of the
SetProfileString statement in which you cannot store a line break
character in the .Value argument.
Word for Windows, Versions 6.0, 7.0, 7.0aIn the following macro, the proof path under the [MSAPPS] heading is changed to C:\WINDOWS\MSAPPS\PROOF.
In Windows 95 and Windows NT, settings are stored in the registry. You can
still use SetProfileString and GetProfileString$() to set and return
settings from a text file with the name WIN.INI, but neither the system nor
Word uses these settings. To access and change values in the registry from
within WordBasic, you need to use GetPrivateProfileString$() and
SetPrivateProfileString.
Word for Windows, Versions 6.xWord 6.0 for Windows stores most of the Word specific settings in the WINWORD6.INI file. This file is located in your \Windows directory. Using the SetPrivateProfileString statement, you can write to the WINWORD6.INI file.
If you are using Word 2.x for Windows, you can use the Microsoft
Windows WritePrivateProfileString command in a WordBasic macro to
write to an .INI file other than the WIN.INI file. For more
information, query on the following words in the Microsoft Knowledge
Base:
private and text and file and windows and callsWARNING: 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. SetProfileString Truncates at Line Break CharacterYou cannot store a line break character or any text that follows the line break in the .Value argument of the SetProfileString statement. If you assign a string to the .Value argument that contains two or more lines, separated by a line break character, SetProfileString stores only the portion of the string that precedes the first line break character.Word for Windows, Versions 2.xIn the following macro, if a DOC-path statement is present in the [Microsoft Word 2.0] section of your WIN.INI file, the DOC-path will be changed to C:\WINWORD:
Word for Windows, Version 1.xThe macro below sets the directory for the WINWORD.INI file to C:\WINWORD. If an INI-path statement is present in the [Microsoft Word] section of your WIN.INI file, the INI-path will be changed to C:\WINWORD.
MORE INFORMATIONWord 97For information about how to do this in Word 97, while in the Visual Basic for Applications Editor click the Office Assistant, type PrivateProfileString, click Search, and then click to view "PrivateProfileString Property." To view examples, point to Example.NOTE: If the Assistant is hidden, click the Office Assistant button on the Standard toolbar. If Microsoft Help is not installed on your computer, please see the following article in the Microsoft Knowledge Base: Q120802 Office: How to Add/Remove a Single Office Program or Component REFERENCES"Using WordBasic," by WexTech Systems and Microsoft, page 284 Additional query words: getprofilestring chopped cut off word6 winword 7.0 word95 word7 winword2 1.10a 2.0 2.0a-cd word8 word97 8.0
Keywords : |
Last Reviewed: September 23, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |