bsharath
asked on
Related post to get email data to excel.
Hi,
Related post to get email data to excel.
the below macro works perfect for a type of emails.
Only issue is the name in colum "H" and "G" workflow data is missing for all.
regards
sharath
Related post to get email data to excel.
the below macro works perfect for a type of emails.
Only issue is the name in colum "H" and "G" workflow data is missing for all.
regards
sharath
Sub Q26477149(mai As MailItem)
Dim dateRecd As String
Dim id As String
Dim raised As String
Dim summary As String
Dim details As String
Dim dateDue As String
Dim workflowID As String
Dim Name As String
Dim ln As Variant
Dim strTemp As String
Dim xlApp As Object
Dim rw As Long
Const xlup As Integer = -4162
If InStr(mai.body, vbCrLf) = 0 Then Exit Sub
dateRecd = Format(mai.ReceivedTime, "ddd dd/mm/yyyy")
For Each ln In Split(Replace(mai.body, Chr(160), " "), vbCrLf)
If InStr(ln, ":") > 0 Then
If LCase(ln) Like "incident id*" Then
id = Trim(Split(ln, ":")(1))
ElseIf LCase(ln) Like "raised user*" Then
raised = Trim(Split(ln, ":")(1))
ElseIf LCase(ln) Like "summary*" Then
summary = Trim(Split(ln, ":")(1))
If InStr(strTemp, "=") > 0 Then
workflowID = Replace(Trim(Split(ln, "=")(1)), ")", "")
End If
If InStr(strTemp, "(") > 0 And InStr(strTemp, ",") > 0 Then
strTemp = Split(ln, ",")(1)
Name = Trim(Split(strTemp, "(")(0)) & " "
End If
If InStr(strTemp, "=") > 0 And InStr(strTemp, ",") > 0 Then
strTemp = Split(ln, ",")(0)
Name = Name & Split(strTemp, "-")(UBound(Split(strTemp, "-")))
End If
ElseIf LCase(ln) Like "details*" Then
details = Trim(Split(ln, ":")(1))
ElseIf LCase(ln) Like "date*" Then
dateDue = Split(Trim(Split(ln, ":")(1)), " ")(0)
End If
End If
Next
Set xlApp = CreateObject("excel.application")
With xlApp.workbooks.Open("C:\Users\Chris\Experts Exchange\Outlook-to-excel.xls")
rw = .sheets(1).Range("A" & .sheets(1).Rows.count).End(xlup).Row + 1
.sheets(1).Range("A" & rw) = dateRecd
.sheets(1).Range("B" & rw) = id
.sheets(1).Range("C" & rw) = raised
.sheets(1).Range("D" & rw) = summary
.sheets(1).Range("E" & rw) = details
.sheets(1).Range("F" & rw) = dateDue
.sheets(1).Range("G" & rw) = workflowID
.sheets(1).Range("H" & rw) = Name
.Close True
End With
xlApp.Quit
End Sub
ASKER
Much better. Just a few are missing. sent that to you
Data supplied like:
Incident Id : 9876543
Raised User : Fred Smith
Summary : reliever
Details : The person noted is leaving the company. Please initiate the collection of assigned company property.
Employee: A S, Jones (IN123456)
Job Title: Actor
Leave date: 01/01/2010
Office location: Television House
Manager: Lew Grade
Date : 1/12/2010 09:00:01 [GMT Daylight Time (GMT+01:00)]
Modification as below.
Chris
Incident Id : 9876543
Raised User : Fred Smith
Summary : reliever
Details : The person noted is leaving the company. Please initiate the collection of assigned company property.
Employee: A S, Jones (IN123456)
Job Title: Actor
Leave date: 01/01/2010
Office location: Television House
Manager: Lew Grade
Date : 1/12/2010 09:00:01 [GMT Daylight Time (GMT+01:00)]
Modification as below.
Chris
ASKER
Chris sorry but the data posted by you with names need to be removed. can you please remove or shall i post a removal request..
it has some official name...
it has some official name...
I'll make the request ... I thought i'd changed evrything I sincerely apologise.
Chris
Chris
Just realised you said delete all, but in order to maintain the integrity of the site I am aware that the admins require dat to be present. In cases where data is exchanged outside of EE as in this case they do expect the experts to ensure the flow of data is available to any viewer.
For this reason I requested an edit to remove the relevant data rather than deletion. i.e. were it to be deleted the question would not be clear to others and would not be in accordance with site rules meaning it would have to be deleted.
I hope I communicated the right data - if not it's probably best you make the request as I again think I have addressed everthing.
Chris
For this reason I requested an edit to remove the relevant data rather than deletion. i.e. were it to be deleted the question would not be clear to others and would not be in accordance with site rules meaning it would have to be deleted.
I hope I communicated the right data - if not it's probably best you make the request as I again think I have addressed everthing.
Chris
ASKER
Thanks Chris now all fine.
Can you post the final code you gave me. That worked perfect for me in all areas...
Can you post the final code you gave me. That worked perfect for me in all areas...
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks a lot Chris works perfect
ASKER
Hi Chris
can you please help with this
https://www.experts-exchange.com/questions/26483653/Outlook-emails-that-are-sent-Need-to-get-data-from-subject-and-to-whome-i-emailed.html
can you please help with this
https://www.experts-exchange.com/questions/26483653/Outlook-emails-that-are-sent-Need-to-get-data-from-subject-and-to-whome-i-emailed.html
ASKER
Chris
Open in new window