Deepak
Excel Ninja
Hi,
Pls check this..
I haven't tested much but might be useful.
Test it & share the remarks & i will validate the same tomorrow.
Pls check this..
I haven't tested much but might be useful.
Test it & share the remarks & i will validate the same tomorrow.
Code:
Sub get_from_eml_3()
Const Rfile As String = "*.eml"
Dim strDir As String, strfile As String, txt As String
Dim t1 As Double, t As Double, x, n As Integer, r As Integer, p As Variant
Dim strDate As String, i As Integer
Application.ScreenUpdating = False
strDir = Application.ThisWorkbook.Path & "\"
strfile = Dir(strDir & Rfile)
r = 2
Do Until strfile = ""
txt = CreateObject("scripting.filesystemobject").OpenTextFile(strDir & strfile).readall
For i = 2 To 8
x = Split(txt, Cells(1, i))
If Not InStr(txt, Cells(1, i)) > 0 Then GoTo n1
Cells(r, i) = Trim(Split(Split(x(1), Chr(10))(0), ":")(1))
n1: Next
On Error Resume Next
If Len(Cells(r, 3)) > 0 Then Cells(r, 9) = Split(Cells(r, 3), " For ")(1)
On Error GoTo 0
Cells(r, 10) = Trim(Mid(Cells(r, 4), 6, 12))
If Not IsDate(Cells(r, 10)) Then Cells(r, 10) = ""
Cells(r, 11) = strfile
r = r + 1
L6: strfile = Dir
Loop
Cells(1, "K") = "File Name"
With Range("A2:A" & r - 1)
.Cells(1, 1).Value = 1
.DataSeries Rowcol:=xlColumns, Type:=xlLinear, Step:=1, Trend:=False
End With
Application.ScreenUpdating = True
End Sub