Вот он:
- Код: Выделить всё
Option Explicit
Private 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
Private Declare Function GetPrivateProfileString Lib _
"kernel32" Alias "GetPrivateProfileStringA" (ByVal _
lpApplicationName As String, ByVal lpKeyName As Any, _
ByVal lpDefault As String, ByVal lpReturnedString As String, ByVal nSize As Long, ByVal lpFileName As String) As Long
'Прочитать ini
Function ReadINIKey(FileName As String, Section As String, KeyName As String) As String
Dim RetVal As String
RetVal = String(255, Chr(0))
ReadINIKey = Left$(RetVal, GetPrivateProfileString(Section, KeyName, "", RetVal, Len(RetVal), FileName))
End Function
'записать ini
Function WriteInIKey(FileName As String, Section As String, KeyName As String, KeyValue As String)
WritePrivateProfileString Section, KeyName, KeyValue, FileName
End Function
При чтении ini VB пишет
Type-declaration character does nod match declarated data type
и показывает на
ReadINIKey = Left$(RetVal, GetPrivateProfileString(Section, KeyName, "", RetVal, Len(RetVal), FileName))
Если убрать значок $ после left то пишет
Compile error: Expected array
И выделяет тоже самое

Вообще код рабочий, но уменя почему-то не работает, почему

Кто-нибудь объясните please такой феномен...