Share via


System.PrivateProfileString Property

Returns or sets a string in a settings file or the Windows registry.

Namespace:  Microsoft.Office.Interop.Word
Assembly:  Microsoft.Office.Interop.Word (in Microsoft.Office.Interop.Word.dll)

Syntax

'Declaration
Property PrivateProfileString ( _
    FileName As String, _
    Section As String, _
    Key As String _
) As String
    Get
    Set
'Usage
Dim instance As System
Dim FileName As String
Dim Section As String
Dim Key As String
Dim value As String

value = instance.PrivateProfileString(FileName, _
    Section, Key)

instance.PrivateProfileString(FileName, _
    Section, Key) = value
string this[
    string FileName,
    string Section,
    string Key
] { get; set; }

Parameters

  • FileName
    Type: System.String
    Required String. The file name for the settings file. If there's no path specified, the Windows folder is assumed.
  • Section
    Type: System.String
    Required String. The name of the section in the settings file that contains Key. In a Windows settings file, the section name appears between brackets before the associated keys (don't include the brackets with Section). If you're returning the value of an entry from the Windows registry, Section should be the complete path to the subkey, including the subtree (for example, "HKEY_CURRENT_USER\Software\Microsoft\Office\version \Word\Options").
  • Key
    Type: System.String
    Required String. The key setting or registry entry value you want to retrieve. In a Windows settings file, the key name is followed by an equal sign (=) and the setting. If you're returning the value of an entry from the Windows registry, Key should be the name of an entry in the subkey specified by Section (for example, "STARTUP-PATH").

Property Value

Type: System.String

Remarks

You can write code that uses a settings file to store and retrieve settings. For example, you can store the name of the active document when you quit Word so that it can be reopened automatically the next time you start Microsoft Word. A settings file is a text file with information arranged like the information in the Windows 3.x WIN.INI file.

See Also

Reference

System Interface

System Members

Microsoft.Office.Interop.Word Namespace