Good day,
Here's an example of emails I receive:
Header Code:STANDARD UPDATE
Ticket No: 20143 Seq. No: 47
Update of: 201428
Send To: ABC Seq No: 6565 Map Ref: 416 531
Original Call Date: 08/20/2014 Time: 10:56:43 AM OP: 997
Transmit Date: 08/20/2014 Time: 10:57:21 AM
Work to Begin Date: 08/27/2014 Time: 08:00:00 AM
.....
Could you suggest how can I split this email body based on the Titles (Header Code:,Ticket No:, Update of
The code I'm using to populate the Access database is
Thank youCode:Private Sub cOutlookGetData_Click() '**************************************************************************************** 'Open Outlook Dim appOutlook As Object Dim folderOutlook As Object ' Initialize outlook objects On Error Resume Next Set appOutlook = GetObject(, "Outlook.Application") If Err <> 0 Then ' attempt to start outlook, can be used to start a second instance of outlook Set appOutlook = CreateObject("Outlook.Application") End If Set namespaceOutlook = appOutlook.GetNamespace("MAPI") Set folderOutlook = namespaceOutlook.GetDefaultFolder(6) '6=Inbox, 5=Sent Items folderOutlook.Display 'make visible '**************************************************************************************** 'ExtractData Dim TempRst As DAO.Recordset Dim rst As DAO.Recordset Dim Mailobject As Object Dim folderOutlookItems As Object Dim db As DAO.Database Dim dealer As Integer 'delete all data from the temp table, disable the warning With DoCmd .SetWarnings False .RunSQL "Delete * from tbl_outlooktemp" .SetWarnings True End With Set db = CurrentDb 'set the database as curretly opened Access database Set TempRst = CurrentDb.OpenRecordset("tbl_OutlookTemp") Set folderOutlookItems = folderOutlook.Items For Each Mailobject In folderOutlookItems 'If Mailobject.UnRead Then With TempRst .AddNew !Subject = Mailobject.Subject !from = Mailobject.SenderName !To = Mailobject.To !Body = Mailobject.Body !DateSent = Mailobject.SentOn .Update Mailobject.UnRead = False End With 'End If Next '**************************************************************************************** 'TidyUp Set namespaceOutlook = Nothing Set appOutlook = Nothing Set folderOutlook = Nothing Set folderOutlookItems = Nothing Set Mailobject = Nothing Set TempRst = Nothing End Sub