AW: csv datei auswahl
13.09.2016 13:50:42
ChrisL
Hi Markus
Richtig testen konnte ich es nicht, aber wird schon funktionieren ;)
Sub t()
Dim PfadName As Variant, sName As String
PfadName = Application.GetOpenFilename("CSV-Datei (*.csv),*.csv")
If PfadName = False Then Exit Sub
sName = Right(PfadName, Len(PfadName) - InStrRev(PfadName, "\"))
sName = Left(sName, Len(sName) - 4)
Range("A19:V30000").ClearContents
With ActiveSheet.QueryTables.Add(Connection:=PfadName, Destination:=Range("$A$19"))
.Name = sName
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.RefreshStyle = xlOverwriteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.TextFilePromptOnRefresh = False
.TextFilePlatform = 437
.TextFileStartRow = 6
.TextFileParseType = xlDelimited
.TextFileTextQualifier = xlTextQualifierDoubleQuote
.TextFileConsecutiveDelimiter = False
.TextFileTabDelimiter = False
.TextFileSemicolonDelimiter = True
.TextFileCommaDelimiter = False
.TextFileSpaceDelimiter = False
.TextFileColumnDataTypes = Array(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, _
1, 1)
.TextFileTrailingMinusNumbers = True
.Refresh BackgroundQuery:=False
End With
Columns("A:V").ColumnWidth = 11
Range("A19").Select
End Sub
cu
Chris