How to open a password protected powerpoint file by Excel macro

  • Follow


how to open a password protected powerpoint file by Excel  macro? by the 
way,the cipher is known.
0
Reply Utf 6/2/2010 6:39:01 AM

Not an expert with PPT; but there is no way to check whether a presentation 
has got a password or presentations.Open do not have an option to pass the 
password. Try the below which worked for me....which uses Sendkeys..

Sub Macro()

Dim pptApp As Object, strFile As String, strPassWord As String

strFile = "d:\Presentation8.ppt"
strPassWord = "password"

Set pptApp = CreateObject("PowerPoint.Application")
pptApp.Visible = True
pptApp.Activate
SendKeys "%F", True
SendKeys "O", True
SendKeys strFile, True
SendKeys "%O", True
SendKeys strPassWord, True
SendKeys "~", True

'Set myPPT = pptApp.Presentations(1)
'MsgBox myPPT.Name

End Sub


-- 
Jacob (MVP - Excel)


"wangww" wrote:

> how to open a password protected powerpoint file by Excel  macro? by the 
> way,the cipher is known.
0
Reply Utf 6/2/2010 9:48:01 AM

If that works; you can combine all Sendkeys as below

SendKeys "%FO" & strFile & "%O" & strPassWord & "~", True

-- 
Jacob (MVP - Excel)


"Jacob Skaria" wrote:

> Not an expert with PPT; but there is no way to check whether a presentation 
> has got a password or presentations.Open do not have an option to pass the 
> password. Try the below which worked for me....which uses Sendkeys..
> 
> Sub Macro()
> 
> Dim pptApp As Object, strFile As String, strPassWord As String
> 
> strFile = "d:\Presentation8.ppt"
> strPassWord = "password"
> 
> Set pptApp = CreateObject("PowerPoint.Application")
> pptApp.Visible = True
> pptApp.Activate
> SendKeys "%F", True
> SendKeys "O", True
> SendKeys strFile, True
> SendKeys "%O", True
> SendKeys strPassWord, True
> SendKeys "~", True
> 
> 'Set myPPT = pptApp.Presentations(1)
> 'MsgBox myPPT.Name
> 
> End Sub
> 
> 
> -- 
> Jacob (MVP - Excel)
> 
> 
> "wangww" wrote:
> 
> > how to open a password protected powerpoint file by Excel  macro? by the 
> > way,the cipher is known.
0
Reply Utf 6/2/2010 10:05:01 AM

2 Replies
235 Views

(page loaded in 0.205 seconds)


Reply: