Outlook Banter

Outlook Banter (http://www.outlookbanter.com/)
-   Outlook and VBA (http://www.outlookbanter.com/outlook-vba/)
-   -   Export e-mail strings to database (http://www.outlookbanter.com/outlook-vba/15384-export-e-mail-strings-database.html)

[email protected] May 22nd 06 03:33 PM

Export e-mail strings to database
 
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.


Eric Legault [MVP - Outlook] May 22nd 06 05:13 PM

Export e-mail strings to database
 
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?

--
Eric Legault (Outlook MVP, MCDBA, MCTS: Messaging & Collaboration)
Try Picture Attachments Wizard for Outlook:
http://www.collaborativeinnovations.ca
Blog: http://blogs.officezealot.com/legault/


" wrote:

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.



[email protected] May 23rd 06 10:12 AM

Export e-mail strings to database
 
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!


Eric Legault [MVP - Outlook] May 23rd 06 09:40 PM

Export e-mail strings to database
 
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

--
Eric Legault (Outlook MVP, MCDBA, MCTS: Messaging & Collaboration)
Try Picture Attachments Wizard for Outlook:
http://www.collaborativeinnovations.ca
Blog: http://blogs.officezealot.com/legault/


" wrote:

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!




All times are GMT +1. The time now is 09:00 PM.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2006 OutlookBanter.com