Hi
Im new in VBA and need help.
I have in Outlook a folder with Statusmails.
Every day must every employee send a Statusmail end of the day, what they did on that day.
I want to export this Emails to Excel for a better View.
The table in the Email has always the same format.
The Table has two columns and is several times in the email.
Table 1
Task | Export Excel
Planed-date | 02.05.2013
deadline | 01.05.2013
finished | no
time effort | 3.5h
description | sdfjl fs dfjsf df aslfj sfdlk
| f djasfsdkfsdjfldjfsj
| fas dfas sf a
Table 2
Task | Computer
Planed-date | 02.05.2013
deadline | 01.05.2013
finished | no
time effort | 3.5h
description | sdfjl fs dfjsf df aslfj sfdlk
| f djasfsdkfsdjfldjfsj
| fas dfas sf a
I can export now every email from the selected folder to excel with this code:
Sub Extract()
On Error Resume Next
Set myOlApp = Outlook.Application
Set mynamespace = myOlApp.GetNamespace("mapi")
Set myfolder = myOlApp.ActiveExplorer.CurrentFolder
Set xlobj = CreateObject("excel.application.14")
xlobj.Visible = True
xlobj.Workbooks.Add
xlobj.Worksheets("Sheet1").Name = "Statusmail"
xlobj.Range("a" & 1).Value = "Absender"
xlobj.Range("a" & 1).Font.Bold = "True"
xlobj.Range("b" & 1).Value = "Date"
xlobj.Range("b" & 1).Font.Bold = "True"
xlobj.Range("c" & 1).Value = "Task"
xlobj.Range("c" & 1).Font.Bold = True
xlobj.Range("d" & 1).Value = "Planed-date"
xlobj.Range("d" & 1).Font.Bold = True
xlobj.Range("e" & 1).Value = "deadline"
xlobj.Range("e" & 1).Font.Bold = True
xlobj.Range("f" & 1).Value = "finished"
xlobj.Range("f" & 1).Font.Bold = True
xlobj.Range("g" & 1).Value = "time effort"
xlobj.Range("g" & 1).Font.Bold = True
xlobj.Range("h" & 1).Value = "description"
xlobj.Range("h" & 1).Font.Bold = True
For i = 1 To myfolder.Items.Count
Set myitem = myfolder.Items(i)
msgtext = myitem.Body
xlobj.Range("a" & i + 1).Value = myitem.To
xlobj.Range("b" & i + 1).Value = myitem.ReceivedTime
xlobj.Range("c" & i + 1).Value = msgtext
Next
End Sub
the text from body is in "msgtext"
the code is implemented in Outlook.
How can I take the elements from the body and put it in a new cell???
the email format is rtf
Can anyone help me?
Thanks & regards chendu