When migrating a customer to Office 365 I had a problem opening the mail control panel applet. It simply showed the error message “Application not found”:
This seemed to be occurring on 64-Bit machines where we had installed 32-Bit Office 2016 from the Office 365 portal.
I found two workarounds for this:
Workaround One: Run the mail applet directly from the command line
- Press Windows Key + R to bring up the run dialog
- Paste the following:
C:\Program Files (x86)\Microsoft Office\root\Office16\MLCFG32.CPL
Workaround Two: Run the mail applet from Outlook 2016
If you in Outlook you can run the control panel mail applet from within Outlook by going to File and clicking on account settings, at the bottom of the account settings drop down you should see a “Manage Profiles” button, which will take you into the mail applet.
I would like to find a proper solution for why this is happening, so if anyone comes across a solution, I’d appreciate it if you share your solution.
It can be very useful to run a VBA macro when new mail is received in Outlook. A customer asked me to write something that would log an entry to a SQL database when a contact form was received.
It’s easy to do but can take a bit of trial and error to get working just how you want it.
You need to add an event listener to the Inbox which will process incoming messages. A the following code to ThisOutlookSession:
Private WithEvents inboxItems As Outlook.Items
Private Sub Application_Startup()
Dim outlookApp As Outlook.Application
Dim objectNS As Outlook.NameSpace
Set outlookApp = Outlook.Application
Set objectNS = outlookApp.GetNamespace("MAPI")
Set inboxItems = objectNS.GetDefaultFolder(olFolderInbox).Items
Private Sub inboxItems_ItemAdd(ByVal Item As Object)
On Error GoTo ErrorHandler
Dim Msg As Outlook.MailItem
If TypeName(Item) = "MailItem" Then
MessageInfo = "" & _
"Sender : " & Item.SenderEmailAddress & vbCrLf & _
"Sent : " & Item.SentOn & vbCrLf & _
"Received : " & Item.ReceivedTime & vbCrLf & _
"Subject : " & Item.Subject & vbCrLf & _
"Size : " & Item.Size & vbCrLf & _
"Message Body : " & vbCrLf & Item.Body
Result = MsgBox(MessageInfo, vbOKOnly, "New Message Received")
MsgBox Err.Number & " - " & Err.Description
You need to restart Outlook for the code to become active.
The above code will produce a simple message box that shows some of the message properties:
You can of course do whatever you like with the message when it is received. I used it to insert rows into a SQL table, then move the message to a different folder. It works very well.
It’s worth taking a look at all of the available properties of the Outlook mailitem that are available:
As this customer is on Office 365 I might investigate the possibility of replicating this functionality with Microsoft Flow.