Option Explicit 'read Private 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 'write Private Declare Function WritePrivateProfileString Lib "kernel32" Alias "WritePrivateProfileStringA" _ (ByVal lpApplicationName As String, _ ByVal lpKeyName As String, _ ByVal lpString As String, _ ByVal lpFileName As String) As Long Sub Read() Dim Rec As String Dim NC As Long Rec = String(255, 0) NC = GetPrivateProfileString("BOOT", "Shell", "", Rec, 255, "D:\test.ini") MsgBox Rec End Sub Sub WriteProfile() Dim NC As Long NC = WritePrivateProfileString("BOOT", "Shell", "Test1", "D:\test.ini") End Sub