Shazam
02-12-2007, 10:33 AM
Hi everyone:hi:
I would like a code to open the last modified text file from my C:\ Drive into a excel workbook. I did a simple macro record but I can't figure it out how to modify it to open the last modified Text File in my C:\ Drive.
Workbooks.OpenText FileName:= _
"C:\.txt", Origin:=437, _
StartRow:=1, DataType:=xlDelimited, TextQualifier:=xlDoubleQuote, _
ConsecutiveDelimiter:=False, Tab:=True, Semicolon:=False, Comma:=False _
, Space:=False, Other:=False, FieldInfo:=Array(Array(1, 1), Array(2, 1)), _
TrailingMinusNumbers:=True
.LastModified = msoLastModifiedAnyTime
.FileName = ""
If .Execute(msoSortByFileName, msoSortOrderDescending, True) > 0 Then
Workbooks.OpenText .FoundFiles(1), xlWindows
End If
End Wit
I tried to modified the code below it but no avial?
Workbooks.OpenText FileName:= _
"C:\.txt", Origin:=437, _
StartRow:=1, DataType:=xlDelimited, TextQualifier:=xlDoubleQuote, _
ConsecutiveDelimiter:=False, Tab:=True, Semicolon:=False, Comma:=False _
, Space:=False, Other:=False, FieldInfo:=Array(Array(1, 1), Array(2, 1)), _
TrailingMinusNumbers:=True
.LastModified = msoLastModifiedAnyTime
.FileName = ""
If .Execute(msoSortByFileName, msoSortOrderDescending, True) > 0 Then
Workbooks.OpenText .FoundFiles(1), xlWindows
End If
End With
I would like a code to open the last modified text file from my C:\ Drive into a excel workbook. I did a simple macro record but I can't figure it out how to modify it to open the last modified Text File in my C:\ Drive.
Workbooks.OpenText FileName:= _
"C:\.txt", Origin:=437, _
StartRow:=1, DataType:=xlDelimited, TextQualifier:=xlDoubleQuote, _
ConsecutiveDelimiter:=False, Tab:=True, Semicolon:=False, Comma:=False _
, Space:=False, Other:=False, FieldInfo:=Array(Array(1, 1), Array(2, 1)), _
TrailingMinusNumbers:=True
.LastModified = msoLastModifiedAnyTime
.FileName = ""
If .Execute(msoSortByFileName, msoSortOrderDescending, True) > 0 Then
Workbooks.OpenText .FoundFiles(1), xlWindows
End If
End Wit
I tried to modified the code below it but no avial?
Workbooks.OpenText FileName:= _
"C:\.txt", Origin:=437, _
StartRow:=1, DataType:=xlDelimited, TextQualifier:=xlDoubleQuote, _
ConsecutiveDelimiter:=False, Tab:=True, Semicolon:=False, Comma:=False _
, Space:=False, Other:=False, FieldInfo:=Array(Array(1, 1), Array(2, 1)), _
TrailingMinusNumbers:=True
.LastModified = msoLastModifiedAnyTime
.FileName = ""
If .Execute(msoSortByFileName, msoSortOrderDescending, True) > 0 Then
Workbooks.OpenText .FoundFiles(1), xlWindows
End If
End With