Skip to content

Latest commit

 

History

History
62 lines (36 loc) · 2.09 KB

Word.Application.ProtectedViewWindowBeforeEdit.md

File metadata and controls

62 lines (36 loc) · 2.09 KB
title keywords f1_keywords api_name ms.assetid ms.date ms.localizationpriority
Application.ProtectedViewWindowBeforeEdit event (Word)
vbawd10.chm4000031
vbawd10.chm4000031
Word.Application.ProtectedViewWindowBeforeEdit
1ea33944-1b2f-f914-f04a-81751cc750f8
06/08/2017
medium

Application.ProtectedViewWindowBeforeEdit event (Word)

Occurs immediately before editing is enabled on the document in the specified Protected View window.

Syntax

expression. ProtectedViewWindowBeforeEdit( _PvWindow_ , _Cancel_ )

expression An expression that returns an Application object.

Parameters

Name Required/Optional Data type Description
PvWindow Required ProtectedViewWindow The Protected View window that contains the document that is enabled for editing.
Cancel Required Boolean False when the event occurs. If the event procedure sets this argument to True, editing is not enabled on the document.

Example

The following code example prompts the user for a yes or no response before enabling editing on a document in a Protected View window. This code must be placed in a class module, and an instance of the class must be correctly initialized for this code example to work correctly. For more information about how to do this, see Using events with the Application object.

The following code example assumes that you have declared an application variable called "App" in your general declarations and have set the variable equal to the Word Application object.

Private Sub App_ProtectedViewWindowBeforeEdit(ByVal PvWindow As ProtectedViewWindow, Cancel As Boolean) 
 Dim intResponse As Integer 
 
 intResponse = MsgBox("Do you really " _ 
 & "want to edit the document?", _ 
 vbYesNo) 
 
 If intResponse = vbNo Then Cancel = True 
End Sub

See also

Application Object

[!includeSupport and feedback]