Hello,

I need to write a code that automatically gets data from a machine log file (saved as *.csv). I have already recorded a macro which gets this information out of a specific file with a specific path.

What I want to have is a code where the user can choose the file himself. I hope you can help me with this. Here is the code:

Sub Einlesen()
    Range("B4").Select
    With ActiveSheet.QueryTables.Add(Connection:= _
        "TEXT;O:\03 Excel\01 Test Einlesen csv\00 .csv" _
        , Destination:=Range("$B$4"))
        .Name = "00 "
        .FieldNames = True
        .RowNumbers = False
        .FillAdjacentFormulas = False
        .PreserveFormatting = True
        .RefreshOnFileOpen = False
        .RefreshStyle = xlInsertDeleteCells
        .SavePassword = False
        .SaveData = True
        .AdjustColumnWidth = True
        .RefreshPeriod = 0
        .TextFilePromptOnRefresh = False
        .TextFilePlatform = 932
        .TextFileStartRow = 8
        .TextFileParseType = xlFixedWidth
        .TextFileTextQualifier = xlTextQualifierDoubleQuote
        .TextFileConsecutiveDelimiter = False
        .TextFileTabDelimiter = True
        .TextFileSemicolonDelimiter = False
        .TextFileCommaDelimiter = False
        .TextFileSpaceDelimiter = False
        .TextFileColumnDataTypes = Array(9, 1, 9, 1, 9)
        .TextFileFixedColumnWidths = Array(1, 8, 49, 5)
        .TextFileTrailingMinusNumbers = True
        .Refresh BackgroundQuery:=False
    End With
End Sub
I appreciate your support!

m4rc