Try this. Let us know if it helps
'In your form
Option Explicit
Private Sub Form_Load()
iniPath = "c:\temp\temp.ini"
End Sub
Private Sub Command2_Click()
Call IniDetailsWrite("Section1", "Value1", "WrittenValue"

End Sub
Private Sub Command1_Click()
MsgBox IniDetailsRead("Section1", "Value1", "Section1Value1"

End Sub
'--------------
'In a module
Option Explicit
Dim sdata As String
Dim lDataLen
Public iniPath As String
Declare Function WritePrivateProfileString _
Lib "kernel32" Alias "WritePrivateProfileStringA" _
(ByVal lpApplicationName As String, ByVal _
lpKeyName As Any, ByVal lsString As Any, _
ByVal lplFilename As String) As Long
Declare Function GetPrivateProfileString Lib _
"kernel32" Alias "GetPrivateProfileStringA" _
(ByVal lpApplicationName As String, ByVal _
lpKeyName As String, ByVal lpDefault As _
String, ByVal lpReturnedString As String, _
ByVal nSize As Long, ByVal lpFileName As _
String) As Long
'Return ini information
Public Function IniDetailsRead(Section As String, Key As String, DefaultValue As String) As String
'you may want to use app.path as the default dir
sdata = Space$(500)
lDataLen = GetPrivateProfileString(Section, Key, DefaultValue, sdata, Len(sdata), iniPath)
IniDetailsRead = Trim(Left$(sdata, lDataLen))
End Function
Public Function IniDetailsWrite(Section As String, Key As String, NewValue As String)
' Set the string value.
Dim retval
retval = WritePrivateProfileString(Section, Key, NewValue, iniPath)
End Function