Pełen zestaw funkcji do obsługi plików ini podał Grzegorz Banasiak (bangr@ld.NoSpamPlease.onet.pl)
'Gotowe funkcje - sprawdzone i działające - cały moduł. Option Compare Database Option Explicit Private Declare Function GetPrivateProfileString Lib "kernel32" _ Alias "GetPrivateProfileStringA" _ (ByVal lpSectionName As String, _ ByVal lpKeyName As Any, _ ByVal lpDefault As String, _ ByVal lpReturnedString As String, _ ByVal nSize As Long, _ ByVal lpFileName As String) As Long Private Declare Function WritePrivateProfileString Lib "kernel32" _ Alias "WritePrivateProfileStringA" _ (ByVal lpSectionName As String, _ ByVal lpKeyName As Any, _ ByVal lpString As Any, _ ByVal lpFileName As String) As Long Public Sub ProfileSaveItem(lpSectionName As String, lpKeyName As String, lpValue As String, inifile As String) Call WritePrivateProfileString(lpSectionName, lpKeyName, lpValue, inifile) End Sub Public Function ProfileGetItem(lpSectionName As String, lpKeyName As String, defaultValue As String, inifile As String) As String Dim success As Long Dim nSize As Long Dim ret As String ret = Space$(2048) nSize = Len(ret) success = GetPrivateProfileString(lpSectionName, lpKeyName, defaultValue, ret, nSize, inifile) If success Then ProfileGetItem = Left$(ret, success) End If End Function Public Sub ProfileDeleteItem(lpSectionName As String, lpKeyName As String, inifile As String) Call WritePrivateProfileString(lpSectionName, lpKeyName, vbNullString, inifile) End Sub Public Sub ProfileDeleteSection(lpSectionName As String, inifile As String) Call WritePrivateProfileString(lpSectionName, vbNullString, vbNullString, inifile) End Sub 'Pozdr, 'GB