ActiveX component cant create object

nniedzielski

Well-known Member
Joined
Jan 8, 2016
Messages
598
Office Version
  1. 2019
Platform
  1. Windows
I am trying to set some code in my macro to send an e-mail of a worksheet but I am getting the following error:

(ActiveX component cant create object)

Code:
Set OutApp = CreateObject("Outlook.Application")

How can I adjust my code to create the object?

thanks,
 

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
I have outlook open, for example, I can use the Share > Email > Send as attachment function in Excel and send an e-mail out through Outlook.
 
Upvote 0
Try

Code:
Set OutApp = GetObject("Outlook.Application")
 
Upvote 0
after researching, I found this code which also does not work

Code:
 On Error Resume Next
        Set OutlookApp = GetObject(Class:="Outlook.Application") 'Handles if Outlook is already open
      Err.Clear
        If OutlookApp Is Nothing Then Set OutlookApp = CreateObject(Class:="Outlook.Application") 'If not, open Outlook
        
        If Err.Number = 429 Then
          MsgBox "Outlook could not be found, aborting.", 16, "Outlook Not Found"
          GoTo ExitSub
        End If
      On Error GoTo 0
 
Upvote 0
What happens when you step through the code?
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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