Function Windows API Class

WriteProfileString

Write a Key Name and Value pair into the Windows Registry.

Signature (Visual Basic / VBA)

Public Function WriteProfileString( _
      Optional ByVal vKeyName As Variant _
    , Optional ByVal vValue As Variant _
    , Optional ByVal vSectionName As Variant _
    ) As Boolean

Code Example

    Assuming
       Dim estWAPI As New WindowsAPI
       estWAPI.ProfileSectionName = "Sample Section"
    for example
       estWAPI.WriteProfileString("Convert From", "5 kilometers") = True

Parameters

Parameter Description
vKeyName Name of the String setting whose value is to be written. Function returns Null if vKeyName is Null or cannot be fixed-up to a String.
vValue The string Value that will be associated with the Name vKeyName. If vValue is Null, the Setting (Name and Value pair) with Name vKeyName will be removed. vValue defaults to Null if it is missing or Null or cannot be fixed-up to a string.
vSectionName The Section within the Profile file or Windows Registry into which the Setting will be written. vSectionName defaults to the current value of the ProfileSectionName Property if it is missing or Null or cannot be fixed-up to a String.

Notes & Version History

v1.3 Change Removed 16-bit support from this function.