AW: Dateinamen bearbeiten
14.11.2012 15:09:25
Rainer
Hallo Rudi,
hier ist der Code den ich verwenden will:
Schau da mal bitte rüber wo ich was verändern muß.
Vielen Dank für deine Hilfe.
Gruß Rainer
Option Explicit
Dim Pfad As String
Dim Dateiname As String
Sub auto_open()
Pfad = "C:\Export"
Dateiname = "Analyse_.lims"
Application.OnTime Now + TimeValue("00:00:00"), "Alle_5_Sekunden"
End Sub
Sub Alle_5_Sekunden()
If Dir(Pfad & Dateiname) "" Then
Application.OnTime Now + TimeValue("00:03:59"), "AusTextDatei"
Else
Application.OnTime Now + TimeValue("00:00:05"), "Alle_5_Sekunden"
End If
End Sub
Sub AusTextDatei()
Sheets("ausgelesene_Daten").Select
Dim intRow As Integer, intCol As Integer
Dim strTxt As String
Dim sFile As String
sFile = "C:\Export\analyse_.lims"
Range("A1:da5").Select
Selection.ClearContents
Range("A1").CurrentRegion.ClearContents
If Dir(sFile) = "" Then
MsgBox "Kann Mess - Datei nicht finden -" _
& Chr(13) & "bitte Excel neu starten" _
& Chr(13) & "und Messung wiederholen"
Exit Sub
Else
Open "C:\Export\analyse_.lims" For Input As #1
End If
Do Until EOF(1)
intRow = intRow + 1
intCol = 0
Line Input #1, strTxt
Do Until InStr(strTxt, ";") = 0
intCol = intCol + 1
Cells(intRow, intCol) = Left(strTxt, InStr(strTxt, ";") - 1)
strTxt = Right(strTxt, Len(strTxt) - InStr(strTxt, ";"))
Loop
Cells(intRow, intCol + 1) = strTxt
Loop
Close
Sheets("ausgelesene_Daten").Select
Range("a1").Select
Kill "C:\Export\analyse_.lims"
Call ausdruck
Call auto_open
End Sub
Sub ausdruck()
Sheets("Ausdruck").Select
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
Sheets("ausgelesene_Daten").Select
End Sub