How to determine if Excel is Protected View?

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

How to determine if Excel is Protected View?
Editing is disabled.... 
George Spears




Posts: 79
Joined: 2010-05-06
Hello,

I have written an Excel plug in...

I have a line in my code that normally works fine. It reads the value of the selected cell.
MycellText := ExcelApp.ActiveCell.Value;

This line does NOT work when I have opened the spreadsheet from an Email attachment. At the top of Excel, there is a bar, which says "Protected View. This file originated as an email attachment and might be unsafe. Click for more details." Then there is a button the says "Enable Editing".

All I am doing is reading a cell... If the spreadsheet is "Protected View", then the code line above causes an AV.

How do I determine is I am in "Protected View" so I can give the user a Warning message?

Thanks
GS
Posted 20 Dec, 2011 08:13:23 Top
Andrei Smolin


Add-in Express team


Posts: 18830
Joined: 2006-05-11
Hello,

In Excel 2010, you need to check if ExcelApp.ActiveProtectedViewWindow <> nil.


Andrei Smolin
Add-in Express Team Leader
Posted 20 Dec, 2011 09:39:55 Top