habe ein kleines problem anbei mein Makro mit dem ich eine TXT Datei in Excel importiere.
Ich möchte jetzt allerdings alle TXT datein in meinem Ordner auf einmal importieren.
weiß jemand wie ich das Makro dazu bekomme?
Sub MBS_laden()
Dim strFilename As String
Dim Pfad$
Dim dtmFaktDatum As Date
Dim lngBankBCNR As String
Dim strBankName As String
Dim strBankOrt As String
Dim lngI As Long 'Zähler
strFilename = Application.GetOpenFilename("ASCdateien (*.asc), *.txt")
If strFilename "Falsch" Then
With ActiveSheet.QueryTables.Add(Connection:="TEXT;" & strFilename, Destination:=Range(" _
A200"))
.Name = "MBS"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.TextFilePromptOnRefresh = False
.TextFilePlatform = 28592
.TextFileStartRow = 1
.TextFileParseType = xlDelimited
.TextFileTextQualifier = xlTextQualifierDoubleQuote
.TextFileConsecutiveDelimiter = False
.TextFileTabDelimiter = True
.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)
.TextFileTrailingMinusNumbers = True
.Refresh BackgroundQuery:=False
strFile = Dir() ' nächste Datei
Loop
End With
End If
End Sub