Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have a macro below that extracts information from a text file. How
can I also get the date and time of the date modified properties of the files as well. And put that information in column E. Sub GetData2() Dim fn As String Dim ln As String Dim FirstLine As String Dim Res As Range Dim fs, f, fl, fc, s Dim i As Long Range("A1").Select Set Res = Range("A1") 'upper left corner of Result range Set fs = CreateObject("Scripting.FileSystemObject") Set f = fs.getfolder("D:\Files\") Set fc = f.Files i = 0 For Each fl In fc If Right(fl.path, 4) = ".TXT" Then fn = fl.path FirstLine = "" Open fn For Input As #1 Do While Not EOF(1) Input #1, ln If FirstLine = "" Then FirstLine = ln Loop Close #1 Res.Offset(i, 0).Value = Left(FirstLine, 8) Res.Offset(i, 1).Value = Mid(FirstLine, 9, 6) Res.Offset(i, 1).NumberFormat = "000000" Res.Offset(i, 2).Value = Mid(ln, 9, 6) Res.Offset(i, 2).NumberFormat = "000000" Res.Offset(i, 3).FormulaR1C1 = "=RC[-1]-RC[-2]+1" Res.Offset(i, 3).NumberFormat = "0" i = i + 1 End If Next fl Range("A1").Select End Sub Thanks |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
File Properties | Excel Discussion (Misc queries) | |||
Properties transferring from excel cells to word file properties | Excel Programming | |||
Get File Properties | Excel Programming | |||
How do I get the file properties? | Excel Programming | |||
Set properties in an XLS file.. | Excel Programming |