Auto Outlook Export

wazza

Registered User.
Local time
Today, 06:59
Joined
Apr 23, 2004
Messages
104
Hi access experts

I would like to automate the following function available in Outlook using a button on an access form:

- User specifies folder and press button to:
- Export emails to Access table
- I would like to maintain the default map
- Create a new table

Please help - Im way behind on a deadline.

Kind Regards
 
Ps. I dont want to link the tables... Unless I can somehow program a form so that a user can create the link using a form/buttons etc.
 
I found the following code below:

Im using outlook 2003, i wish to export all content of an email and properties just like the outlook export action. My email accounts are either POP or IMAP.

How can I amend the following code to do the job?!



Sub Command0_Click()

Set nms = Application.GetNamespace("MAPI")
strFolder = ""

Set fld = nms.Folders("Personal Folders").Folders(strFolder)

'Pick up path to Access database directory from Access SysCmd function

Set appAccess = CreateObject("Access.Application")
strAccessPath = appAccess.SysCmd(9)
'Get DAO version from DBEngine
strDBEngine = appAccess.Application.DBEngine.Version
'MsgBox "DBEngine version: " & strDBEngine
appAccess.Quit
If strDBEngine = "3.51" Then
'Office 97 DAO version
Set dbe = CreateObject("DAO.DBEngine.35")
strDBName = strAccessPath & "db1.mdb"
ElseIf strDBEngine = "3.6" Then
'Office 2000 DAO version
Set dbe = CreateObject("DAO.DBEngine.36")
strDBName = strAccessPath & "db1.mdb"
Else
MsgBox "Unknown Office version; canceling"
Exit Sub
End If

'MsgBox "DBName: " & strDBName
Set wks = dbe.Workspaces(0)
Set dbs = wks.OpenDatabase("C:\Documents and Settings\warren\My Documents\DB")

'Open Access table containing contact data
Set rst = dbs.OpenRecordset("Table1")

'Set up reference to Outlook folder of items to export
Set itms = fld.Items
ItemCount = itms.Count
If ItemCount = 0 Then
MsgBox "No communication requests to export"
Exit Sub
Else
MsgBox ItemCount & " Communication requests to export"
End If


'Set up reference to Outlook folder of items to export
Set itms = fld.Items
ItemCount = itms.Count
If ItemCount = 0 Then
MsgBox "No Communication requests to export"
Exit Sub
Else
MsgBox ItemCount & " Communication requests to export"
End If

For Each itm In itms
rst.AddNew
'Custom Outlook properties

rst.Datecircular = itm.Senton
rst.Subject = itm.Subject
rst.circular = itm.HTMLBody
rst.Update
Next

rst.Close
MsgBox "All communication requests exported!"
MsgBox "Quit Access"
appAccess.Quit


End Sub
 

Users who are viewing this thread

Back
Top Bottom