2507
« on: July 25, 2012, 05:32:17 AM »
hello,
i have written a small macro to write values into a file.
macro:
'Funktion zum schreiben in INI Datei
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
Sub Main()
' -------------------------------------------------------------------------------
' TPS 25.07.2012
' Der im P-Parameter übergebene Wert wird für Werkzeug im Q Parameter im Configfile abgelegt
' -------------------------------------------------------------------------------
'beim Laden des Files Abbrechen
If IsLoading() Then
GoTo Ende
End If
'Übergebene Parameter holen------------------------------------------------------
ZWert = Param1()
Werkzeug = Param2()
'--------------------------------------------------------------------------------
Dim File As String
Dim Sektion As String
Dim Eintrag As String
Dim Wert As String
Dim n As Long
'Parameter festlegen ------------------------------------------------------------
File = "C:\Platemaster\Config.txt"
Sektion = "Werkzeuglaengen"
Eintrag = CStr(Werkzeug)
Wert = CStr(ZWert)
'--------------------------------------------------------------------------------
'Wert schreiben
n = WritePrivateProfileString(Sektion, Eintrag, Wert, File)
'MsgBox (CStr(n))
Ende:
End Sub
tryed for a couple of hours to get it work.
only the file is created but nothing is written.using the same function in VB6 and ist working fine.
probably somebody has an idea, because i am out of ideas now.
thanks Thomas