Hi All here is a simple way to save to an ini file:
strExpiryDate = GetIni("NE", "Verify", "\\W2kserver emplates\DoNotDelete.ini")
and “strExpiryDate” should hold a string containing a date.
The following code is the module that holds the function…
Module ini
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
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
Function GetIni(ByVal Section As String, ByVal ID As String, ByVal IniFile As String) As Object
Dim ValueLength As Long
Dim Value As String
ValueLength = GetPrivateProfileString(Section, ID, "", Value, Len(Value), IniFile)
If ValueLength > 0 Then GetIni = Left$(Value, ValueLength) Else GetIni = ""
End Function
Function PutIni(ByVal Section As String, ByVal ID As String, ByVal Value As String, ByVal IniFile As String)
Dim a As Integer
a = WritePrivateProfileString(Section, ID, Value, IniFile)
End Function
End Module
Result
[NE]
Verify=01/01/2004