Saturday, June 9, 2012

Menghapus Section Pada INI File

Option Explicit

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

Public Sub DeleteKey(Section As String, Key As String, PathIni As String)
Dim sSection As String
Dim sKey As String
Dim sFileName As String
sSection = Section
sKey = Key
sFileName = PathIni
If Len(Trim(sKey)) <> 0 Then
WritePrivateProfileString sSection, sKey, vbNullString, sFileName
Else
WritePrivateProfileString sSection, sKey, vbNullString, sFileName
End If
End Sub