Matthew Hankins,
Having looked at the example, it is a bit unclear. What I should have done is just given you my code, so here it is. Basically when the form loads it sets a path to the ini, although you could do this in the subs
Hope that helps, and sorry for anu confusion. Any problems then let me know
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
Dim strInI As String
Private Sub Form_Load()
strInI = "C:\temp\temp.ini"
End Sub
Private Sub WriteIni_Click()
'write
WritePrivateProfileString "Heading", _
"Key", "Value2", strInI
End Sub
Public Sub ReadIni_Click()
Dim strTmp As String
Dim lngRet As String
strTmp = String$(100, 0)
lngRet = GetPrivateProfileString("Heading", _
"Key", "", strTmp, _
Len(strTmp), strInI)
MsgBox strTmp
End Sub