VBA: Send mail via Outlook in Excel for Mac 2011

丶灬走出姿态 提交于 2019-12-11 16:48:17

问题


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?


回答1:


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


来源:https://stackoverflow.com/questions/20030084/vba-send-mail-via-outlook-in-excel-for-mac-2011

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!