Access/VBA Library

INI_SetSection

Replaces or inserts a new section in the INI-file and adds the content of values to this section.

Syntax

INI_SetSection( section, values )
Parameters
Name Type Description
section String Required. Name of the section to be added or inserted.
values Dictionary Required. Content of the section. It should contain at least one element.
Code
Public Sub INI_SetSection(ByVal section As String, values As Dictionary)
    Dim varKey
    ' Section exists? Remove it!
    If INI_SectionExists(section) Then
        Call INI_Remove(section)
    End If
    '
    For Each varKey In values.Keys
        Call INI_SetValue(section & "." & varKey, values.Item(varKey))
    Next varKey
End Sub
Dictionarytag:Dictionary

Remarks

  • When values has no elements no section will be inserted. If the section already exists, it will be deleted.

See also

  • INI_SectionExists
  • INI_Remove
  • INI_SetValue