How to detect "Protected view" mode

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

How to detect "Protected view" mode
 
Destaque Empreendimentos em Inform?tica


Guest


I have a situation where I have to check if Word, Excel and Powerpoint have opened a file in "Protected Mode".

That happens when the file was downloaded from the internet.

Is there any property from
: _Document;
: _Workbook;
: _Presentation;

which I can check?
Or somewhere else?

tks
Mario
Posted 26 Sep, 2017 14:25:32 Top
Andrei Smolin


Add-in Express team


Posts: 18793
Joined: 2006-05-11
Hello Mario,

To represent a document/presentation/workbook opened in a protected view window, Office creates a ProtectedViewWindow object; it is stored in the ProtectedViewWindows collection. The active window can be accessed using the ActiveProtectedViewWindow property of the Application project. See e.g. https://msdn.microsoft.com/VBA/PowerPoint-VBA/articles/application-activeprotectedviewwindow-property-powerpoint and https://msdn.microsoft.com/en-us/vba/powerpoint-vba/articles/application-protectedviewwindows-property-powerpoint. Note that the objects and members related to protected views were introduced in Office 2010.


Andrei Smolin
Add-in Express Team Leader
Posted 27 Sep, 2017 02:22:55 Top
Destaque Empreendimentos em Inform?tica


Guest


Hello Andrei,

I tried to access the ActiveProtectedViewWindow property using the following code:

WordApp.ActiveProtectedWindow.Caption

For my surprise my Delphi XE4 says that 'TWordApplication' does not contain a member named 'ActiveProtectedWindow'

I checked my environment and all my Word2010.dcu are dated from 2013 as well as files in RAD Studio\11.0\OCX\Servers.

I tried to download and install a new Professional version from AddInexpress Professional but I can't find new Word2010.pas or Word2010.dcu in the package.

How to proceed to get access to these new Word classes?

Mario
Posted 16 Oct, 2017 12:41:03 Top
Andrei Smolin


Add-in Express team


Posts: 18793
Joined: 2006-05-11
Hello Mario,

ActiveProtectedViewWindow, not ActiveProtectedWindow.


Andrei Smolin
Add-in Express Team Leader
Posted 17 Oct, 2017 05:29:41 Top
Destaque Empreendimentos em Inform?tica


Guest


Sorry, that was a misspelling.

Anyway.

There is no ActiveProtectedViewWindow, just ActiveWindow.

My questions that my Delphi keep "remembering" the old classes still.

What can I do?

Best regards,
Mario Scheel
Posted 05 Nov, 2017 10:55:23 Top
Andrei Smolin


Add-in Express team


Posts: 18793
Joined: 2006-05-11
Hello Andrew,

You need to import type library for Outlook 2010 or above and use it; an example of importing and using the type library for Outlook 2010 is given at http://www.add-in-express.com/forum/read.php?FID=1&TID=12731&MID=64876#message64876.

Hope this helps.


Andrei Smolin
Add-in Express Team Leader
Posted 06 Nov, 2017 02:56:50 Top