Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Reading TSv files in Excel
Hi!
I would like to read a TSV file in Excel. It is quite a big process I want to make, so let's being in steps. My first question is how I can search into a folder and select the last modified TSv file. i recorded already a macro, the code is showed just belown. So, how can I change my code to make it happen that Excel is reading in my last modified file? Thanx Code: Sub TSV_File() ' ' TSV_File Macro ' Macro recorded 2006-09-29 by Bernard Wesseling ' ' ChDir "H:\Model folder\results" Workbooks.OpenText Filename:= _ "H:\Model folder\results\TEA5760_HN_2006 Sep 29.tsv", Origin:=xlWindows, _ StartRow:=1, DataType:=xlDelimited, TextQualifier:=xlDoubleQuote, _ ConsecutiveDelimiter:=False, Tab:=True, Semicolon:=False, Comma:=False _ , Space:=False, Other:=False, FieldInfo:=Array(Array(1, 2), Array(2, 2), _ Array(3, 2), Array(4, 2), Array(5, 1), Array(6, 1), Array(7, 2), Array(8, 2), Array(9, 1), _ Array(10, 2), Array(11, 2), Array(12, 2), Array(13, 1)) Range("A1:L1").Select Selection.Columns.AutoFit Rows("3:3").Select ActiveWindow.FreezePanes = True End Sub |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Reading TSv files in Excel
For finding and working with file, look into use Dir() and FileDateTime().
e.g. something like this Dim FileName as string dim ThisFileTime as double dim OldestFileName as string dim OldestFileTime as double filename=Dir(PathToYourFolder & "\*.tsv) do until filename="" ThisFileTime=filedatetime(PathToYourFolder & "\" & filename) if ThisFileTime<OldestFileTime then OldestFileTime= ThisFileTime OldestFileName =filename end if loop By TSV, I assume you mean a Tab separated Value file. Excel can import these pretty easily. NickHK wrote in message oups.com... Hi! I would like to read a TSV file in Excel. It is quite a big process I want to make, so let's being in steps. My first question is how I can search into a folder and select the last modified TSv file. i recorded already a macro, the code is showed just belown. So, how can I change my code to make it happen that Excel is reading in my last modified file? Thanx Code: Sub TSV_File() ' ' TSV_File Macro ' Macro recorded 2006-09-29 by Bernard Wesseling ' ' ChDir "H:\Model folder\results" Workbooks.OpenText Filename:= _ "H:\Model folder\results\TEA5760_HN_2006 Sep 29.tsv", Origin:=xlWindows, _ StartRow:=1, DataType:=xlDelimited, TextQualifier:=xlDoubleQuote, _ ConsecutiveDelimiter:=False, Tab:=True, Semicolon:=False, Comma:=False _ , Space:=False, Other:=False, FieldInfo:=Array(Array(1, 2), Array(2, 2), _ Array(3, 2), Array(4, 2), Array(5, 1), Array(6, 1), Array(7, 2), Array(8, 2), Array(9, 1), _ Array(10, 2), Array(11, 2), Array(12, 2), Array(13, 1)) Range("A1:L1").Select Selection.Columns.AutoFit Rows("3:3").Select ActiveWindow.FreezePanes = True End Sub |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
reading .sxls files in Office XP 2002 Excel | Excel Discussion (Misc queries) | |||
Reading data from other files | Excel Programming | |||
Reading dbf files | Excel Discussion (Misc queries) | |||
Reading dbf files | Excel Programming | |||
Reading all files in a folder | Excel Programming |