VBA保护PowerPoint的Presentation只读

应为在PowerPoint下我们要用到事件所以我们只能通过UserForm或Class来处理相应的事务。下面是一个极简单的例子,具体事务需大家扩充。

Private WithEvents app As Application
Private flag As Boolean

Private Sub app_ProtectedViewWindowBeforeEdit(ByVal ProtViewWindow As ProtectedViewWindow, Cancel As Boolean)
    Cancel = True
End Sub

Private Sub CommandButton1_Click()
    Set app = Application
    If TextBox1.Text = "123456" Then
        app.ProtectedViewWindows.Open "C:\*****.pptx"
        flag = True
    Else
        flag = False
    End If
End Sub

Private Sub UserForm_Initialize()
    flag = False
End Sub


欢迎访问《 许阳的红泥屋

你可能感兴趣的:(poi)