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

I am trying to use a VBA module to open a protected PPTX file, unlock it, then edit and save as.I cur

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

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744921707a4601172.html

相关推荐

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

    I am trying to use a VBA module to open a protected PPTX file, unlock it, then edit and save as.I cur

    1天前
    40

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信