MacroProtectionLevel=6 ignored when loading via COM?

Discussion created by andrew_Inwood on Jun 20, 2013
Latest reply on Jun 21, 2013 by andrew_Inwood

I'm sure I had this working before, but not now.


I am trying to programatically open some files, some of which have VBA compile errors.  I have set the MacroProtectionLevel to 6 (disable), and if I manually open PI ProcessBook, and then manually open an affected display, the VBA code errors are ignored (as expected).


However, when I use the PI SDK to create a PI application object: 

m_oPIApp = new PBObjLib.Application();

 ...and then load a display:

//Now open the new display.
m_oDisplay = m_oPIApp.Displays.Open(sDisplayFullPath, true);    //True means that display will be converted if required.

 I get VBA errors.


Aside from frustrating me in terms of what I'm trying to do, I think it is a bit of a security risk!


Any idea on how to resolve this?








Edit:  I found that if I create the application programatically (and make it visible), and then manually load a display, then the macros don't fire.  It is the Displays.Open() method that is apparently alowing the macros to execute.