-2

I've created a macro in Excel to create and display a new email with the BCC, Subject, and Body fields filled with data from specific cells in the excel worksheet. It's basic and gets the job done.

I have a plugin called "Smart Email" added to Outlook that when used to send an email, keeps track of open rates and click rates of the "smart emails" I send. I'd like the VBA macro to create a "smart email" and not just a regular email.

How would I look up the object name of a addin or plugin in Outlook? For example, is there a smart email (the add-in) object code that I could swap in for the standard new outlook email “emailApplication.createitem(0)” line item? Or, do default microsoft items only show in the object library?

Sub CreateEmail()

'Set the variables:
Dim emailApplication As Object
Dim emailItem As Object

Set emailApplication = CreateObject("Outlook.Application")
Set emailItem = emailApplication.createitem(0)

'To build the email. The body text, email addresses and subject line are saved in the excel cells listed below:

With emailItem
    .Body = Range("D17")
    .BCC = Range("D15")
    .Subject = Range("D16")
    .Display
    
End With

End Sub
Eugene Astafiev
  • 47,483
  • 3
  • 24
  • 45
JAmeen
  • 1
  • 1

1 Answers1

0

The Outlook object model doesn't provide any API for communicating between VBA macros and web add-ins. But you may communicate with COM add-ins in Office applications using the COMAddIns property which returns a COMAddIns collection that represents all the Component Object Model (COM) add-ins currently loaded in Microsoft Outlook. See Walkthrough: Call code in a VSTO Add-in from VBA for more information.

The best what you could do is to programmatically click the ribbon controls or any other UI using Accessibility API (Windows API). There is no trivial solution for that.

Feature requests on Tech Community are considered, when the dev team go through the planning process. Use the github label: Type: product feature request at https://aka.ms/M365dev-suggestions .

Eugene Astafiev
  • 47,483
  • 3
  • 24
  • 45
  • Confirming Eugene's answer here. In general mixing COM Add-ins with Web Add-ins is not supported. There are certainly places where they interact. (i.e. the are reading from the same properties, or if you create a new mail with COM, it will trigger a OnNewMessage Web LaunchEvent) However, the features are not intended to be used together. – Outlook Add-ins Team - MSFT Sep 30 '22 at 23:08