Gruppe
Extern
Problem
Ich möchte Variablen über das Schließen der Arbeitsmappe hinaus für einen späteren Aufruf deponieren. Wie mache ich das, wenn ich sie nicht in der Arbeitsmappe selbst speichern möchte?
StandardModule: basMain
Sub VariablenStore()
Dim arr(1 To 10) As String
Dim iCounter As Integer, iFile As Integer
Dim sFile As String
sFile = Application.Path & "\VarStore.txt"
For iCounter = 1 To 10
arr(iCounter) = "Zeile" & iCounter
Next iCounter
iFile = FreeFile
Open sFile For Output As iFile
For iCounter = 1 To 10
Print #iFile, arr(iCounter)
Next iCounter
Close iFile
MsgBox "Variablen gespeichert unter:" & vbLf & sFile
End Sub
Sub VariablenLesen()
Dim iFile As Integer
Dim sFile As String, sTxt As String, sText As String
iFile = FreeFile
sFile = Application.Path & "\VarStore.txt"
Open sFile For Input As iFile
Do Until EOF(iFile)
Line Input #iFile, sTxt
sText = sText & sTxt & vbLf
Loop
Close iFile
MsgBox sText
Kill sFile
End Sub