I suddenly remembered the code bank when I did a post in the General VB Forum. Might be useful to some. Anyways, to delete a section from an INI file, you use the WritePrivateProfileString API. A typical code example would look something like this:

VB Code:
  1. 'this goes into the declaration section of the
  2. 'code
  3. Declare Function WritePrivateProfileString Lib "kernel32" Alias "WritePrivateProfileStringA" (ByVal lpApplicationName As String, ByVal lpKeyName As Any, ByVal lpString As Any, ByVal lpFileName As String) As Long
  4.  
  5. Public sub DeleteKey
  6. Dim sSection As String
  7. Dim sKey As String
  8. Dim sFileName as String
  9.  
  10. sSection = "Section1"
  11. sKey = "Key1"
  12. sFileName="C:\MyINIFILE.INI"
  13.  
  14. 'if the key exists, delete it from the section
  15.    If len(trim(sKey)) <>0 Then
  16.       WritePrivateProfilestring sSection, sKey, _
  17.          vbNullString, sFileName
  18.    Else
  19.       'no key specified, then delete section
  20.       WritePrivateProfileString _
  21.          sSection,sKey,vbNullString,sFileName
  22.    End If
  23. End Sub