【问题标题】:Open password protected presentation打开受密码保护的演示文稿
【发布时间】:2019-11-25 11:29:33
【问题描述】:

如何使用 C# 或 VBA 打开受密码保护的 PowerPoint 演示文稿,在 excel workbook.open 中,该方法具有密码参数。但在 PowerPoint 中,它没有。

在 PowerPoint 中Presentation.Open 方法没有密码参数

在 Excel 中,我可以使用 Application.Workbooks.Open(Filename,Password) 但 PowerPoint 中没有等效项

PowerPoint 文档打开时需要输入密码

【问题讨论】:

标签: c# vba vsto powerpoint office-interop


【解决方案1】:

这将起作用: 在 VBA 中测试

Dim PVW As ProtectedViewWindow, Pres As Presentation

Set PVW = ProtectedViewWindows.Open("Full Path ", "Password")

Set Pres = PVW.Edit("modify")

另一种方法:未经测试

Sub SetPassword()

    With Presentations.Open(FileName:="C:\My Documents\Earnings.ppt")

        .Password = complexstrPWD 'global variable

        .Save

        .Close

    End With

End Sub

取自:Link

【讨论】:

  • 真的需要DoEvents 调用吗? FWIW 从文档复制的底部示例看起来像是 setting 密码;我希望 PowerPoint 在Presentations.Open 返回之前提示输入密码以打开。
  • 是的,即使我这么认为,这也是我发布第一个的原因。这是一个经过测试的代码。对于DoEvents,虽然不是真的需要。它在代码中。我会删除它们。
猜你喜欢
  • 2020-02-07
  • 1970-01-01
  • 1970-01-01
  • 2021-03-28
  • 2011-10-11
  • 2021-10-08
  • 2015-11-26
  • 2020-08-29
  • 2013-12-11
相关资源
最近更新 更多