You can use your favorite social network to register or link an existing account:
Or use your email address to register without a social network:
Sign in with these social networks:
Or enter your username and password
Forgot your password?
Yes, please link my existing account with for quick, secure access.
No, I would like to create a new account with my profile information.
I got some great questions recently about macros and Protected View in Word 2010, and thought I'd write something up to help anyone else who's looking at this issue - enjoy!
Word 2010 includes enhancements to security, one of which is the inclusion of a Protected View used when opening files from untrusted sources (e.g. email attachments). The inclusion of Protected View can require changes to the way that solutions interact with Word documents, as some object model methods/properties are disabled while in Protected View.
This introductory post on the Office 2010 Engineering blog provides an excellent description of Protected View.
In short, Protected View provides a safe read-only view of all untrusted Office documents which allows you to view the document content without the need to worry about documents from malicious sources causing damage to your computer.
It looks like Word because it is Word; it's just a version of Word that has been carefully restricted to prevent malicious content from accessing any other part of your computer. With Protected View, you can view files without worrying about their source.
Part of the restricted environment provided by Protected View limits the access that documents in this view have to Word's object model – the following sections describe how macro behaviors change when documents are opened in Protected View, and how you can write code that's compatible with Protected View windows.
When a document is opened in Protected View, document events are limited as follows:
As well, an AutoOpen macro stored in any global document template will be executed.
If the user chooses to enable editing of the document (leaving Protected View), all appropriate events will be triggered at that time, and any associated code will be executed.
The Protected View Events section below describes all of the events which can be captured for Protected View windows.
If macro code (for example, an AutoOpen macro) is run in a context in which in which the document is in Protected View, either of the following mechanisms can be used to detect this condition:
The following sample macro shows a dialog box only if the document is in Protected View:
Sub Test() If Not Application.ActiveProtectedViewWindow Is Nothing Then MsgBox "In Protected View" End IfEnd Sub
Without access to the ActiveDocument property of the Application object, the following methods must be used to get the current document and window objects:
The following sample macro shows the file's location in a dialog box only if the document is in Protected View:
Sub Test() If Not Application.ActiveProtectedViewWindow Is Nothing Then MsgBox Application.ActiveProtectedViewWindow.Document.FullName End IfEnd Sub
Architecturally, as described in the blog post referenced above, the protection in Protected View is accomplished by splitting the Word window into two processes: a host process that owns the top level application frame window, which includes the window caption, the ribbon, the trust bar, status bar, etc. and a client process that loads and displays the document content. Accordingly, the object model allows macros to access an Application object corresponding to the trusted host process, and an Application object corresponding to the untrusted client process.
While a document is in Protected View, Word provides a specific set of application-level events that allow for control of the Protected View window via those two Application objects:
For each of the Application object's window-level events available while not in Protected View, an analogous event is available in Protected View as well:
The following events are triggered from either Application object with the corresponding event handlers:
The following events are only triggered from the Application object for the client process (the object returned from the Application property of the Document property of a ProtectedViewWindow object):
The following sample code shows how a solution can capture the WindowSelectionChange event via the Application object for the Protected View window, by first using the ProtectedViewWindowOpen event to get the Application object:
Dim WithEvents oApp as ApplicationDim WithEvents oAppProtView As ApplicationSub AutoOpen() Set oApp = ApplicationEnd SubPrivate Sub oApp_ProtectedViewWindowOpen(ByVal Window As ProtectedViewWindow) Set oAppProtView = Window.Document.ApplicationEnd SubPrivate Sub oAppProtVew_WindowSelectionChange(ByVal Sel As Selection) 'code to handle event would go hereEnd Sub
Along with the events triggered while not in Protected View, three additional events are available for solutions that interact with Protected View windows:
The following sample code illustrates how an add-in might capture the events available in Protected View to perform logic before a file in Protected View is edited:
Dim WithEvents oApp as ApplicationSub AutoOpen() Set oApp = ApplicationEnd SubPrivate Sub oApp_ProtectedViewWindowBeforeEdit(ByVal Window As ProtectedViewWindow, Cancel As Boolean) 'code to run before the file can be edited goes hereEnd Sub
Although Protected View requires some modifications to existing solutions, solutions can easily detect when a window is in Protected View and:
- Tristan
Comments: (2) Collapse
Hi Tristan - Is there a way to review macros in a document from the Protected View? I'd like to be able to see whether there is malicious code in a document without enabling editing.
esta bien yo nomas necesito actulalizas el word que tengo
Comments: (loading) Collapse