Function
WorkSheetExists(
ByVal
WS
As
Variant
)
As
Boolean
On
Error
Resume
Next
WorkSheetExists = Worksheets(WS)
Is
Nothing
End
Function
Sub
LoadData()
With
Application.FileDialog(msoFileDialogFilePicker)
.Show
AnzahlDatein = .SelectedItems.Count
If
.SelectedItems.Count = 0
Then
MsgBox
"cancel"
Exit
Sub
End
If
fStr = .SelectedItems(1)
End
With
Dateiname = Dir(fStr, vbNormal)
SheetName = Split(Dateiname,
"."
)(0)
If
WorkSheetExists(SheetName) =
True
Then
Exit
Sub
Sheets(
"Speicher"
).
Select
With
ThisWorkbook.Sheets(
"Speicher"
).QueryTables.Add(Connection:= _
"TEXT;"
& fStr, Destination:=Range(
"$A$1"
))