Export e-mail strings to database

  • Thread starter Thread starter nemesis345crew
  • Start date Start date
N

nemesis345crew

Well I wabt to ask all of you AND IF

ANYONE KNOWS TO LET ME KNOW:

Is there any way to insert mail strings to a database without doing
copy paste each one a time?

The strings are a request from a form!
Unfortunately those mail was received before we made a method so they
are inserted at once in the data base.
 
This is a very general question! The Outlook Object Model and ADO libraries
provides all the plumbing you need to read from Outlook and write to a
database. Can you be more specific please?
 
I have a huge number of emails, which including text is sth like that:

name: tonia
occupation: unemployed
married: no
education: college

(this is just a sample which is similar to mine so you can understand
who thing goes)

Now all these mails i want to insert them into an MS Access database in
table with that kind of construction:

column1 --> name
column2 --> occupation
column3 --> married
column4 --> education

All i'm asking is if that huge number of mails, can be inserted into
the base, because the manually way it will take "years".

Well now I hope you could understand what kind of problem do i have!
 
There is very much possible. Below is an example of reading all e-mails in
the current folder and creating a new record in an Access database using DAO.
You can easily modify it to parse the message body to get the field/value
combinations you want, or switch to using ADO instead:

Sub WriteEmailToDatabase()
Dim objFolder As Outlook.MAPIFolder, objItems As Outlook.Items
Dim objEmail As Outlook.MailItem, objMessageObj As Object
Dim dbsThis As DAO.Database, rstThis As DAO.Recordset

Set dbsThis = DAO.OpenDatabase("C:\Documents and
Settings\elegault\Desktop\db1.mdb")
Set rstThis = dbsThis.OpenRecordset("Table1", dbOpenDynaset)

Set objFolder = Application.ActiveExplorer.CurrentFolder
Set objItems = objFolder.Items
For Each objMessageObj In objItems
If objMessageObj.Class = olMail Then
Set objEmail = objMessageObj

'SAVE TO ACCESS DATABASE
rstThis.AddNew
rstThis("Subject") = objEmail.Subject
rstThis("Body") = objEmail.Body
rstThis.UPdate
End If
Next
End Sub
 
Back
Top