Gruppe
Extern
Problem
Wie kann ich in einer *.ini Datei eine Zeile austauschen?
StandardModule: basMain
Sub CreateFile()
Dim iFile As Integer, iCounter As Integer
Dim sFile As String, sTxt As String
iFile = FreeFile
sFile = Application.Path & "\texttest.txt"
Open sFile For Output As iFile
For iCounter = 1 To 10
Print #iFile, "Zeile" & iCounter
Next iCounter
Close iFile
Workbooks.OpenText _
Filename:=sFile, _
DataType:=xlDelimited, _
tab:=False, _
semicolon:=False, _
comma:=False, _
Space:=False, _
other:=False
MsgBox "Weiter"
ActiveWorkbook.Close savechanges:=False
End Sub
Sub ChangeFile()
Dim iFile As Integer, iCounter As Integer
Dim sFileA As String, sFileB As String, sTxt As String
iFile = FreeFile
sFileA = Application.Path & "\texttest.txt"
sFileB = Application.Path & "\temp.txt"
Open sFileA For Input As iFile
Open sFileB For Output As iFile + 1
Do Until EOF(iFile)
Line Input #iFile, sTxt
iCounter = iCounter + 1
If iCounter = 5 Then
Print #iFile + 1, "Fünfte Zeile"
Else
Print #iFile + 1, sTxt
End If
Loop
Close
Kill sFileA
Name sFileB As sFileA
Workbooks.OpenText _
Filename:=sFileA, _
DataType:=xlDelimited, _
tab:=False, _
semicolon:=False, _
comma:=False, _
Space:=False, _
other:=False
MsgBox "Weiter"
ActiveWorkbook.Close savechanges:=False
Kill sFileA
End Sub