Hello Guest it is March 28, 2024, 01:06:10 PM

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - TPS

Pages: « 1 2 3
21
hello,

i have written a small macro to write values into a file.

macro:
Code: [Select]
'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


Pages: « 1 2 3