'Følgende ligges i et modul (basfil)
'Declaretion for writing to an .ini file
Public Declare Function WritePrivateProfileString _
Lib "kernel32" Alias "WritePrivateProfileStringA" _
(ByVal lpApplicationname As String, ByVal _
lpKeyName As Any, ByVal lsString As Any, _
ByVal lplFilename As String) As Long
'Declaretion for read from an .ini file
Public 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
'variables for reading and writing .ini files
'They are dimensioned here becaus then the module
'can be freely moved to other programs
Global lngResult As Long
Global strFileName
Global strResult As String * 50
-------------------------------------------------------------------------
'Read option setup from .ini file
strFileName = App.Path & "\setup.ini"
lngResult = GetPrivateProfileString("Gruppe", _
"Type", strFileName, strResult, Len(strResult), _
strFileName)
'If value = 0 reports an error
If lngResult = 0 Then
Call MsgBox("An error has occurred", _
vbExclamation)
Else
If Trim(strResult) = 1 Then
MsgBox ("Her skal handlingen for værdi 1 stå")
ElseIf Trim(strResult) = 2 Then
MsgBox ("Her skal handlingen for værdi 2 stå")
End If
End If
---------------------------------------------------------------------------
'Write option to an ini file
strFileName = App.Path & "\Setup.ini"
lngResult = WritePrivateProfileString("Gruppe", _
"Type", "Værdi", strFileName)
---------------------------------------------------------------------------
det vil se sådan her ud i ini filen:
[Gruppe]
Type=Værdi
under hver gruppe kan der være flere typer, så det er bare lave en ny write hvor du skriver noget andet en type, kan f.eks. være type2....
/Tubber
PS. Du skrev noget i spg:
http://exp.dk/spm/267059Hvad mener du med det ?