Classic Outlook gets an official death date as users are urged to switch. Microsoft wants everyone off classic Outlook by April 2026, but will continue to support it until at least 2029.
This will be a problem for developers who rely on using Outlook to send email via VBA. Of course, other methods are available. I personally still use Outlook to receive email into my Access database. Looks like I'll be hunting for a new solution for that.
Microsoft's announcement to sunset classic Outlook by 2026 renders this tutorial idea moot. However, here's the outline I had prepared for teaching people how to push emails into a Microsoft Access database using Outlook, instead of pulling them from Access. Feel free to adapt it for any use before it's no longer applicable.
---
Enable Macros in Outlook
File > Options > Trust Center > Trust Center Settings > Macro Settings
Enable "All Macros" (only if this is YOUR system and you're confident no one else has access).
---
Turn on the Developer Ribbon
Enable the Developer ribbon in Outlook if it isn't already turned on.
---
Default Inbox Limitation
This process works only for your default inbox. If you use separate PST files, additional steps are required. If there's interest, I could have covered that in a Part 2.
To locate data files: File > Account Settings > Data Files (PST)
---
Open VBA Editor
1. Open the VB Editor and navigate to the Project Explorer.
2. Drill down to `ThisOutlookSession`.
Add the following code in `ThisOutlookSession`:
1. Application Startup (Test with a Message Box):
CodeDim oNS As Outlook.NameSpace
Dim WithEvents oItems As Outlook.Items
Private Sub Application_Startup()
Dim oInbox As Outlook.Folder
Set oNS = Application.GetNamespace("MAPI")
Set oInbox = oNS.GetDefaultFolder(olFolderInbox)
Set oItems = oInbox.Items
Set oInbox = Nothing
End Sub
2. ItemAdd Event (Trigger with a Message Box):
CodePrivate Sub oItems_ItemAdd(ByVal Item As Object)
ProcessMailItem Item
Set Item = Nothing
End Sub
Tip: You can trigger this by moving an email from Drafts or Trash into the Inbox.
---
Create a Standard Module
1. Add a reference to the "Microsoft Office 16.0 Access Database Engine Object Library."
2. Add the `ProcessMailItem` subroutine:
CodePublic Sub ProcessMailItem(Item As MailItem)
Dim db As Database, rs As Recordset
On Error GoTo EndOfSub
Set db = OpenDatabase("Z:\OutlookMailTemp.accdb")
Set rs = db.OpenRecordset("OutlookT")
rs.AddNew
rs!FromName = Item.SenderName
rs!Email = Item.SenderEmailAddress
rs!Subject = Item.Subject
rs!Body = Item.Body
rs!EmailDate = Item.SentOn
rs!EmailTo = Item.To
rs.Update
rs.Close
db.Close
Set rs = Nothing
Set db = Nothing
Item.Delete
EndOfSub:
' Other fields not imported: Item.BodyFormat, Item.Sender, Item.CC, Item.ReceivedTime
' Attachments can be extracted - future lesson if demand
End Sub
---
Extracting Attachments
Attachment extraction is possible but was not covered here.
---
Integrate with Access
In your Access database:
1. Link to `Z:\OutlookMailTemp.accdb`.
2. Replace any existing "pull from Outlook" routines with a simple append query to move records from `OutlookMailTemp.accdb` into your local table.
---
If Microsoft's decision hadn't killed this workflow, there could have been more advanced lessons, like handling attachments or working with non-default inboxes. Feel free to reuse any of this for your own projects before Outlook is replaced entirely.
Worth writing it as its own blog post?
Could be a Code Vault item? A Glossary page or is the Written Articles still hanging about?
Matt Hall
@Reply 2 years ago
There is still 2-5 years of potential use for it, assuming Microsoft doesn't change course along the way. I wouldn't be uncomfortable creating the tutorial with a disclaimer at the beginning. Like you, most of us are still using Outlook right now. Besides, the hard part is done. :)
Yeah... Maybe. I put this together because I was sick of getting the occasional security popup from Outlook when Access tries to read email. Even though I've done everything possible to disable it, it still shows up once in a while (usually when I'm on vacation and have to remote into my PC to fix it). Pushing the email from Outlook to Access eliminates that. Maybe I'll make a TechHelp on it.
Thomas Gonder
@Reply 2 years ago
I've been using, what I think is Classic Outlook for over 25 years (I estimate). About a year ago a popup encouraged me to try the new Outlook. It made such a mess of my data I had to do a restore.
Has anyone had recent experience changing to the new Outlook with success?
Does this mean code for the Classic version won't work with the newer version?
Not being up on all things Office, I'm curious as to what older features are missing in the new version, and how important they are to our work in Access. And curious how Microsoft can announce Classic death with features still missing in the newer one?
Sorry, only students may add comments.
Click here for more
information on how you can set up an account.
If you are a Visitor, go ahead and post your reply as a
new comment, and we'll move it here for you
once it's approved. Be sure to use the same name and email address.
This thread is now CLOSED. If you wish to comment, start a NEW discussion in
Captain's Log.