sieht durch das Probieren schon krum aus.
Bis zum Dateiaufruf bleibt er leider auf der
"Menü"
Seite.
Sub
sub_import()
Sheets(
"wait"
).Visible =
True
Blatt =
"IMP01"
Sheets(Blatt).Visible =
True
Sheets(Blatt).Delete
Sheets.Add Before:=Sheets(
"Menü"
)
ActiveSheet.Name = Blatt
ActiveWindow.DisplayGridlines =
False
Sheets(Blatt).Visible =
False
Range(
"A1"
).
Select
Sheets(Blatt).Visible =
True
Sheets(
"IMP01"
).
Select
Dim
IMPORTDATEI
As
String
Application.DisplayAlerts =
True
Application.ScreenUpdating =
True
Sheets(
"wait"
).
Select
Sheets(
"wait"
).Activate
Cells(1, 1).
Select
Sheets(
"wait"
).
Select
Cells(1, 1).
Select
Application.DisplayAlerts =
False
Application.ScreenUpdating =
False
Sheets(
"wait"
).
Select
Cells(1, 1).
Select
MsgBox (
"Bitte wählen Sie die AnaCredit Bundesbank-Datei aus."
& Chr(13) &
"(Sollte *.xml-Datei sein)"
)
IMPORTDATEI = Application.GetOpenFilename(
"Text Files (*.xml), *.xml"
)
If
Right(IMPORTDATEI, 3) =
"xml"
Or
Right(IMPORTDATEI, 3) =
"bat"
Then
GoTo
weiter2
Else
:
Call
sub_ende
End
If
weiter2:
Cells(1, 1).
Select
Sheets(
"IMP01"
).
Select
With
ActiveSheet.QueryTables.Add(Connection:=
"TEXT;"
& IMPORTDATEI, Destination:=Range(
"$A$1"
))
.FieldNames =
True
.RowNumbers =
False
.FillAdjacentFormulas =
False
.PreserveFormatting =
True
.RefreshOnFileOpen =
False
.RefreshStyle = xlInsertDeleteCells
.SavePassword =
False
.SaveData =
True
.AdjustColumnWidth =
True
.RefreshPeriod = 0
.TextFilePromptOnRefresh =
False
.TextFilePlatform = 65001
.TextFileStartRow = 1
.TextFileParseType = xlDelimited
.TextFileTextQualifier = xlTextQualifierDoubleQuote
.TextFileConsecutiveDelimiter =
False
.TextFileSemicolonDelimiter =
False
.TextFileCommaDelimiter =
False
.TextFileSpaceDelimiter =
False
.TextFileOtherDelimiter =
"<"
.TextFileColumnDataTypes = Array(1, 1)
.TextFileTrailingMinusNumbers =
True
.Refresh BackgroundQuery:=
False
End
With
Range(
"A1"
).
Select
Worksheets(
"IMP01"
).Cells(10, 1) = IMPORTDATEI
xxx = Mid(IMPORTDATEI, InStrRev(IMPORTDATEI, "\") + 1)
Worksheets(
"IMP01"
).Cells(12, 1) = Mid(IMPORTDATEI, InStrRev(IMPORTDATEI, "\") + 1)
Worksheets(
"IMP01"
).Cells(11, 1) = Mid(IMPORTDATEI, 1, Len(IMPORTDATEI) - Len(xxx))
Application.DisplayAlerts =
True
Application.ScreenUpdating =
True
Sheets(
"wait"
).
Select
Cells(1, 1).
Select
Application.DisplayAlerts =
False
Application.ScreenUpdating =
False
End
Sub