Hi Guys,

I am trying to use ini files which will act as a mini database for outlook. So VBA code will create a text file (ini file) and data is stored in a text file so everytime you need to change the data then it doesn't require changing the code . The code works fine. The highlighted lines will store data in a listbox eventually and my question is if the listbox is 2 column listbox then how can we change those lines as below:

e.g
1,aaa
2,bbb
3,ccc
4,ddd
5,eee
6,fff
7,ggg

00,aaaa
11,bbbb
22,cccc

etc...



Const IniFileName As String = "u:\test.ini"
Const ThisVersion As String = "1.1"
' the path and filename to the file containing the information you want to read/write
Private Declare Function GetPrivateProfileStringA Lib "Kernel32" (ByVal strSection As String, _
   ByVal strKey As String, ByVal strDefault As String, ByVal strReturnedString As String, _
   ByVal lngSize As Long, ByVal strFileNameName As String) As Long
  
Private Declare Function WritePrivateProfileStringA Lib "Kernel32" (ByVal strSection As String, _
   ByVal strKey As String, ByVal strString As String, ByVal strFileNameName As String) As Long


Sub SaveIni()


' saves information in the file IniFileName
    If Not WritePrivateProfileString32(IniFileName, "VersionInfo", "Version", "1.0") Then
        MsgBox "Not able to save user info in " & IniFileName, vbExclamation, "Folder does not exist!"
        Exit Sub
    End If
    
    WritePrivateProfileString32 IniFileName, "VersionInfo", "VersionErrorText", "You are not running the correct version of this Software. Please contact Joe Bloggs or Jane Doe"


    WritePrivateProfileString32 IniFileName, "Indexes", "PreCompletion", "aaa|bbb|ccc|ddd|eee|fff|ggg"
    WritePrivateProfileString32 IniFileName, "Indexes", "PostCompletion", "aaaa|bbbb|cccc|dddd|eeee|ffff|gggg"
    WritePrivateProfileString32 IniFileName, "Indexes", "MortgageServices", "111|222|333|444|555|666|777|888|999|000"


End Sub
Private Function WritePrivateProfileString32(ByVal strFileName As String, ByVal strSection As String, ByVal strKey As String, ByVal strValue As String) As Boolean
Dim lngValid As Long
    On Error Resume Next
    lngValid = WritePrivateProfileStringA(strSection, strKey, strValue, strFileName)
    If lngValid > 0 Then WritePrivateProfileString32 = True
    On Error GoTo 0
End Function


Private Function GetPrivateProfileString32(ByVal strFileName As String, ByVal strSection As String, ByVal strKey As String, Optional strDefault) As String
Dim strReturnString As String, lngSize As Long, lngValid As Long
    On Error Resume Next
    If IsMissing(strDefault) Then strDefault = ""
    strReturnString = Space(2048)
    lngSize = Len(strReturnString)
    lngValid = GetPrivateProfileStringA(strSection, strKey, strDefault, strReturnString, lngSize, strFileName)
    GetPrivateProfileString32 = Left(strReturnString, lngValid)
'   On Error GoTo 0
End Function