Microsoft KB Archive/118834

-

{| The information in this article applies to:
 * width="100%"|
 * Microsoft Word for the Macintosh, version 6.0

SYMPTOMS
Using the GetProfileString$ function to return a path setting in the Word Settings (6) file results in a path that contains "garbage" (corrupted) characters or symbols. For example, the following sample macro, which retrieves the path setting for the Templates directory, returns garbage text:

Sub MAIN a$=GetProfileString$("Microsoft Word", "USER-DOT-PATH") MsgBox a$  End Sub Note that the GetProfileString$ function does not require a file name or path argument for the Word Settings (6) file after "USER-DOT-PATH". WordBasic defaults to the Word Settings (6) file in the Preferences folder. Microsoft provides programming examples for illustration only, without warranty either expressed or implied, including, but not limited to, the implied warranties of merchantability and/or fitness for a particular purpose. This article assumes that you are familiar with the programming language being demonstrated and the tools used to create and debug procedures. Microsoft support engineers can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific needs. If you have limited programming experience, you may want to contact the Microsoft fee-based consulting line at (800) 936-5200. For more information about the support options available from Microsoft, please see the following page on the World Wide Web:

http://www.microsoft.com/supportnet/refguide/

CAUSE
When retrieving predefined file path settings in the Microsoft Word section of the Word Settings (6) file, Word makes a second call to the settings file, and the incorrect information is returned. The problem, which occurs when reading the Word Settings (6) file when using the GetProfileString$ function, is a known problem.

RESOLUTION
To avoid returning unusable information, use the GetPrivateProfileString$ function. The GetPrivateProfileString$ function returns a setting in a settings file that you specify, for example:

Sub MAIN a$=GetPrivateProfileString$("Microsoft Word", "USER-DOT-PATH", \     "Word Settings (6)") MsgBox a$  End Sub Note that the GetPrivateProfileString$ function requires that you specify settings file name. In this case it is "Word Settings (6)." When retrieving values from the Word Settings (6) file with the GetPrivateProfileString$ function, do not specify a path for the Word Settings (6) parameter because this path defaults to the Preferences folder in the System folder.

MORE INFORMATION
Predefined file path settings in the Microsoft Word section of the Word Settings (6) file are those that are set in the File Locations tab. (To locate this option, click Options on the Tools menu.) Settings other than "User Options" can only be returned by macro functions if they are first set in the File Locations tab.
 * }

-

Last reviewed: March 26, 1998

© 1998 Microsoft Corporation. All rights reserved. Terms of Use.