01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28 |
|
Private Declare PtrSafe Function GetPrivateProfileStringA Lib "kernel32" ( _
ByVal lpApplicationName As String, ByVal lpKeyName As Any, ByVal lpDefault As String, _
ByVal lpReturnedString As String, ByVal nSize As Long, ByVal lpFileName As String) As Long
Private Declare PtrSafe Function WritePrivateProfileStringA Lib "kernel32" ( _
ByVal lpApplicationName As String, ByVal lpKeyName As Any, ByVal lpString As Any, _
ByVal lpFileName As String) As Long
Function SetGetInidaten(sBereich As String, sItem As String, Optional sDaten As String) As String
' Schreibt Daten in die Textdatei oder liest Daten aus der Textdatei
Dim sPfad As String, sTxt As String * 5000, l As Integer
sPfad = Environ$("TEMP") & "\MeineTexbox.txt"
If sDaten <> "" Then
WritePrivateProfileStringA sBereich, sItem, sDaten, sPfad
Else
l = GetPrivateProfileStringA(sBereich, sItem, "none", sTxt, 5000, sPfad)
SetGetInidaten = Left$(sTxt, l)
End If
End Function
Sub Schreibewas()
SetGetInidaten "Sektor1", "Textbox1", UserForm1.TextBox1.Value
End Sub
Sub Lesewas()
UserForm1.TextBox1.Value = SetGetInidaten("Sektor1", "Textbox1")
End Sub
|