Prevent add-in from loading when Host is being automated (via OLE)?

Add-in Express™ Support Service
That's what is more important than anything else

Prevent add-in from loading when Host is being automated (via OLE)?
 
Philip Street


Guest


Is there a very simple way of preventing an add-in from loading/initialising if the host application has started as a result of OLE Automation?

I ask because we have an old Access 97 app that creates documents with Excel mailmerges (resulting in at least 20 loading/unloading of Word/Excel).

I know I could add extra code to account for this, e.g. global variable being setup in the add-in shutdown event, but I thought there may be a really simple elegant way of doing the above.

Cheers,

Phil
Posted 28 Mar, 2007 17:14:22 Top
Sergey Grischenko


Add-in Express team


Posts: 7233
Joined: 2004-07-05
Hi Phil.

Please try to use the Visible property of the Excel._Application interface.



P.S. Note that we take up your forum requests in the order we receive them.
Besides, it may take us some time to investigate your issue. Please be sure we will let you know as soon as the best possible solution is found.
Posted 29 Mar, 2007 09:49:38 Top
Philip Street


Guest


Sergey

That works fine in Excel. I have also tried a similar technique in Outlook, PowerPoint and Word, but have found the following:

  • Outlook - does not have a Visible property
  • PowerPoint - Visible property is False (msoFalse) when the application is started
  • Word - this works, just like Excel

Additionally, in Excel and Word the Visible property is a Boolean, whereas the Visible property of PowerPoint is Office.MsoTriState and has the following values;

msoCTrue = 1
msoFalse = 0
msoTriStateMixed = -2
msoTriStateToggle = -3
msoTrue = -1

So I have several issues.

  • 1. Outlook does not have a Visible so am unable to prevent the add-in from loading for OLE Automation of Outlook
  • 2. The Visible property in PowerPoint does not appear to work properly, i.e. it incorrectly evaluates to False when it should be True

Can you please assist with this?

Many thanks,

Phil Street
Posted 28 Jun, 2007 10:18:36 Top
Sergey Grischenko


Add-in Express team


Posts: 7233
Joined: 2004-07-05
Hi Phil.

In Outlook you can use the ActiveExplorer method or Explorers collection to detect if the add-in is loaded via OLE Automation.

As to PowerPoint, I didn't investigate its object model concerning this subject. Probably it has any methods or properties that are not accessible via automation. I will let you know if I find something.
Posted 28 Jun, 2007 12:18:43 Top
Philip Street


Guest


Sergey

I've taken a look at both ActiveExplorer and Explorers collection but cannot see anything obvious. Can you tell me what property I am supposed to be checking? We have several old apps that do OLE Automation of Outlook so it's important we suppress the loading of our add-in in this scenario.

PowerPoint - that would be very helpful, although probably not a high priority as it is unlikely that there are any apps here that do OLE Automation of PowerPoint.

Thanks

Phil
Posted 28 Jun, 2007 14:32:10 Top
Sergey Grischenko


Add-in Express team


Posts: 7233
Joined: 2004-07-05
Phil, if Outlook is loaded via OLE Automation, the Explorers collection should be empty.


Posted 29 Jun, 2007 13:44:28 Top