Question

On a Mac, Office 2011 (latest patches) I want to send a mail via Outlook

Set mailer = CreateObject("Outlook.Application")

which gives the error

ActiveX component can't create object

which seems believable since there is no ActiveX on the Mac.

I tried to find alternative solutions, but

  • they are quite dated (2011)
  • the macro has to work on both Mac and Windows

What is currently the best VBA way to send a mail via Outlook in Office Mac 2011?

Was it helpful?

Solution

cf/ http://msdn.microsoft.com/en-us/library/hh859489(v=office.14).aspx

As you note, Mac does not have ActiveX components.

For your VBA, use the above link to handle the Mac case, and use an if statement (see pseudo-code below):

If Application.OperatingSystem = "MAC" Or Application.OperatingSystem = "Macintosh" OR ...
    DoMacSendMail
Else
    DoWindowsSendMail
End If
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top