Beispiel: In der Info.bat steht in Zeile 7 "REM Sonnenschein". Ich möchte mit Hilfe von VBA aus dieser bestimmten Batchdatei die Zeile 7 als Wert in eine Zelle eintragen.
Geht das? Wenn ja, wie?
Vielen Dank schon mal im Voraus.
Maik
Sub test()
Dim strText As String
Dim intFile As Integer, intZeile As Integer
intFile = FreeFile
Open "C:\adaptec\aspi\install.bat" For Input Access Read Lock Read As #intFile
For intZeile = 1 To 7
Input #intFile, strText
Next
Close #intFile
Cells(1, 1) = strText
End Sub
Private Sub einlesen()
Dim byFF As Byte
Dim byI As Byte
Dim strText As String
byFF = FreeFile
Open "c:\info.bat" For Input As byFF
byI = 1
Do While Not EOF(byFF)
Line Input #byFF, strText: If byI = 7 Then Exit Do
byI = byI + 1
Loop
Close byFF
Sheets("Tabelle3").Cells(1, 1) = strText
End Sub