Macro to open Outlook App Doesn't Work Anymore

sspatriots

Well-known Member
Joined
Nov 22, 2011
Messages
585
Office Version
  1. 365
Platform
  1. Windows
I have this macro that I found that used to open the Outlook App to a new e-mail. A generic version is below. However, it will not work on PC's with this "New Outlook" option switched on.

VBA Code:
Sub OpenNewOutlookMessage()
    Dim outlookApp As Object
    Dim newMail As Object
    
    ' Create an instance of Outlook
    Set outlookApp = CreateObject("Outlook.Application")
    
    ' Create a new mail item
    Set newMail = outlookApp.CreateItem(0)  ' 0 represents a new mail item
    
    ' Set properties for the mail item (e.g., subject, body, recipients)
    newMail.Subject = "New Email Subject"
    newMail.Body = "This is the body of the email."
    newMail.To = "recipient@example.com"
    
    ' Display the new mail item
    newMail.Display
End Sub


Any help would be much appreciated. I need something that works for both versions of Outlook. Thanks, SS
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
go to TOOLS- REFERENCES
check out Microsoft Outlook
1719869005004.png
 
Upvote 0
I think the issue is likely New Outlook. I believe MS removed COM support and thus traditional programmability and automation by Windows and Office applications. There is a fair amount of info on the web.



If I had a lot of outlook based automation code, I'd be sticking to the "old" outlook as long as possible.
 
Upvote 0

Forum statistics

Threads
1,224,810
Messages
6,181,079
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top