AW: Basic Hilfe benötigt
16.07.2004 09:38:05
Thomas
Grüezi Thomas
Wie gesagt; binde die Auswahl der Datei in das Makro mit ein.
Das kann dann wie folgt aussehen:
Sub Makrowind()
' Makrowind Makro
' Makro am 16.07.2004 aufgezeichnet
' Tastenkombination: Strg+w
Dim strDatei As String
strDatei = Application.GetOpenFilename("Text Files (*.txt), *.txt")
If strDatei = "" Then Exit Sub
With ActiveSheet.QueryTables.Add(Connection:= _
strDatei, _
Destination:=Range("A1"))
.Name = "xyz"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.TextFilePromptOnRefresh = False
.TextFilePlatform = 850
.TextFileStartRow = 1
.TextFileParseType = xlFixedWidth
.TextFileTextQualifier = xlTextQualifierDoubleQuote
.TextFileConsecutiveDelimiter = False
.TextFileTabDelimiter = True
.TextFileSemicolonDelimiter = False
.TextFileCommaDelimiter = False
.TextFileSpaceDelimiter = False
.TextFileColumnDataTypes = Array(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1)
.TextFileFixedColumnWidths = Array(14, 7, 19, 9, 9, 9, 9, 9, 9, 9, 9, 9)
.TextFileDecimalSeparator = "."
.TextFileThousandsSeparator = ","
.TextFileTrailingMinusNumbers = True
.Refresh BackgroundQuery:=False
End With
End Sub
Mit freundlichen Grüssen
Thomas Ramel