Sub
Makro2()
Dim
varPfadUndDatei
As
Variant
varPfadUndDatei = Application.GetOpenFilename(
"CSV Files (*.csv),& *.csv"
)
ActiveWorkbook.Queries.Add Name:=
"meas01 (2)"
, Formula:= _
"let"
& Chr(13) &
""
& Chr(10) &
" Quelle = Csv.Document(File.Contents(varPfadUndDatei),[Delimiter="
","
", Columns=5, Encoding=1252, QuoteStyle=QuoteStyle.None]),"
& Chr(13) &
""
& Chr(10) &
" #"
"Typ ändern"
" = Table.TransformColumnTypes(Quelle,{{"
"Column1"
", type text}, {"
"Column2"
", type text}, {"
"Column3"
", type text}, {"
"Column4"
", type text}, {"
"Column5"
", type text}})"
& Chr(13) &
""
& Chr(10) &
"in"
& Chr(13) &
""
& Chr(10) &
" #"
"Typ ändern"
""
ActiveWorkbook.Worksheets.Add
With
ActiveSheet.ListObjects.Add(SourceType:=0, Source:= _
"OLEDB;Provider=Microsoft.Mashup.OleDb.1;Data Source=$Workbook$;Location="
"meas01 (2)"
";Extended Properties="
""
""
_
, Destination:=Range(
"$A$1"
)).QueryTable
.CommandType = xlCmdSql
.CommandText = Array(
"SELECT * FROM [meas01 (2)]"
)
.RowNumbers =
False
.FillAdjacentFormulas =
False
.PreserveFormatting =
True
.RefreshOnFileOpen =
False
.BackgroundQuery =
True
.RefreshStyle = xlInsertDeleteCells
.SavePassword =
False
.SaveData =
True
.AdjustColumnWidth =
True
.RefreshPeriod = 0
.PreserveColumnInfo =
True
.ListObject.DisplayName =
"meas01__2"
.Refresh BackgroundQuery:=
False
End
With
Range(
"G11"
).
Select
End
Sub