Office
A suite of Microsoft productivity software that supports common business tasks, including word processing, email, presentations, and data management and analysis.
414 questions
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Hello Microsoft Team,
When I try to send an e-mail in Excel via VBA using Outlook, I get the error message: "An error has occurred: Object creation not possible through ActiveX component", It works via the Outlook application. If I switch to the New Outlook, the error message appears.
For testing, I used the following coding in Excel:
Sub SendEmail(what_address As String, subject_line As String, mail_body As String)
Dim olApp As Object
Dim olMail As Object
On Error GoTo ErrorHandler
Set olApp = GetObject(, "Outlook.Application")
If olApp Is Nothing Then Set olApp = CreateObject("Outlook.Application")
Set olMail = olApp.CreateItem(0)
olMail.To = what_address
olMail.Subject = subject_line
olMail.body = mail_body
olMail.Send
Exit Sub
ErrorHandler:
MsgBox "An error occurred: " & Err.Description
End Sub
Thank you and best regards
Torsten
Hi @Torsten_688
This error message can occur if there are issues with the Outlook object model or if there are compatibility issues between Excel and Outlook. Here are a few things you can try:
Best Regards.