最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

powerpoint - How to unlock PPT using VBA for editing - Stack Overflow

programmeradmin2浏览0评论

I am trying to use a VBA module to open a protected PPTX file, unlock it, then edit and save as. I currently have all the script working if the file is not locked, but I have no clue as to how to unlock a PPTX file using VBA 7.1.

Here is the code that I use. I just need to know the VB code to unlock the pptx file:

Sub UpdatePPT()
Dim oPPApp As Object, oPPPrsn As Object, oPPSlide As Object
Dim oPPShape As Object
Dim FlName As String
Dim desktopFolderPath As String
Dim cellData As String
Dim password As String


desktopFolderPath = CreateObject("WScript.Shell").specialfolders("Desktop")
password = "Password123"
cellData = Range("Input!E21").Value
   
Const ppSaveAsDefault = 11

'~~> Change this to the relevant file
FlName = (desktopFolderPath & "\BES RCA Files\BES RCA Template DO NOT EDIT.pptx")

'~~> Establish an PowerPoint application object
On Error Resume Next
Set oPPApp = GetObject(, "PowerPoint.Application")

If Err.Number <> 0 Then
    Set oPPApp = CreateObject("PowerPoint.Application")
End If
Err.Clear
On Error GoTo 0

oPPApp.Visible = True

'~~> Open the relevant powerpoint file
Set oPPPrsn = oPPApp.Presentations.Open(FlName)
''''

When I try to add the ::password:: as suggested, it gives me the following error: Error when adding password

发布评论

评论列表(0)

  1. 暂无评论