Access/VBA Library


Returns a Boolean indication if the section exists.


INI_SectionExists( section )
Name Type Description
section String Required. The name of the section to be searched.
Return value

Boolean : True if the section exists, False if not.

Public Function INI_SectionExists(ByVal section As String) As Boolean
    Dim vSection
    Dim colSections As Collection
    ' Get list of all sections in the INI-file
    Set colSections = INI_GetSections()
    ' Search for the section specified
    For Each vSection In colSections
        If vSection = section Then
            INI_SectionExists = True
            Exit Function
        End If
    Next vSection
    ' When arrivered over here, the section has not been found
    INI_SectionExists = False
End Function

See also

  • INI_GetSections