Obračam se na vašo pomoč. V Excelu sem posnel spodnji makro, ki importira točno določeno TXT datoteko z točno določeno širino posameznih stolpcev:
Koda: Izberi vse
Sub test()
'
' test Macro
' Macro recorded 11.5.2007 by bostjanp
'
'
With ActiveSheet.QueryTables.Add(Connection:= _
"TEXT;P:\Podatki.txt" _
, Destination:=ActiveCell)
.Name = "Podatki"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.TextFilePromptOnRefresh = False
.TextFilePlatform = xlWindows
.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, 1, 1, 1)
.TextFileFixedColumnWidths = Array(11, 2, 3, 27, 10, 10, 9, 6, 8, 9, 6, 8, 31, 9, 9)
.Refresh BackgroundQuery:=False
End With
End Sub
Za odgovore se zahvaljujem
Boštjan